How to switch from Spotlight to Alfred via Terminal

alfredhomebrewlaunchdspotlightterminal

I installed Alfred through homebrew-cask. I want to disable Spotlight and let Alfred be opened with Cmd+S.

The first Terminal-based solution I tried was unloading Spotlight with sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist. However, this makes homebrew fail with "couldn't get the client port", and it's known.

The second one was to change Spotlight shortcut by accessing System Preferences -> Spotlight and disabling the option "Spotlight menu keyboard shortcut". It worked.

What I still don't like is that this solution isn't portable, and I can't add that to my dotfiles. Also, Spotlight still runs, but I think I will have to deal with it because I need homebrew to work.

Best Answer

Alfred requires Spotlight to function properly.

Alfred relies on the same OS X metadata index as Spotlight. As such, it's important for you to let Spotlight run on your Mac to maintain an index of the files on it.

http://support.alfredapp.com/kb:spotlight

This answer to a similar question provides a shell command to stop Spotlight's GUI only, which will disable Spotlight's shortcut.