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.