Terminal / Shell
If you frequently need to launch Terminal or shell commands, you can do so from within Alfred.
Prefix your shell command with > and Terminal will launch and run the command for you.
Changing Terminal preferences
In the Terminal / Shell preferences, you can choose an alternative prefix to > from a dropdown menu. You can also choose a different terminal application; By default, we support the macOS Terminal app.
Custom Terminal integration
Choose the "Custom" option from the dropdown if you'd like to use your own AppleScript for terminal actions for Terminal apps.
Wrap the custom Terminal AppleScript in on alfred_script(q)
and end alfred_script
, for example:
on alfred_script(q)
tell application "Terminal"
activate
do script q
end tell
end alfred_script
iTerm integration
If iTerm is your terminal app of choice, you can find some excellent iTerm integration AppleScripts for the older and newer versions of iTerm on Alfred user Vítor Galvão's Custom iTerm Applescripts for Alfred Github page.
Using Terminal for advanced tasks
If you want to run more complex scripts and AppleScripts, take a look at the Workflows feature, which allows you to create advanced scripts connected to keywords and hotkeys.
You can also launch the Browse in Terminal action from a workflow.