So I got fed up with this and decided to fix it the hard way.
I found out where Spotlight initializes the status bar item, and I just patched the status bar size to zero. This requires editing the Spotlight binary. (Note that Search.bundle
is just the little stub that gets loaded into SystemUIServer
to allow Spotlight.app
to control the status bar).
You'll have to use the Terminal to execute some commands.
For OS X 10.10 (Yosemite):
cd /System/Library/CoreServices/Spotlight.app/Contents/MacOS
sudo cp Spotlight Spotlight.bak
sudo perl -pi -e 's|(\x48\xb8\x00\x00\x00\x00\x00\x00)\x42\x40(\x48\x89\x47\x10\x48\xB8\x00\x00\x00\x00\x00\x00\x36\x40)|$1\x00\x00$2|sg' Spotlight
cmp -l Spotlight Spotlight.bak
sudo codesign -f -s - Spotlight
sudo killall Spotlight
For OS X 10.11 (El Capitan):
cd /System/Library/CoreServices/Spotlight.app/Contents/MacOS
sudo cp Spotlight Spotlight.bak
sudo perl -pi -e 's|(\x00\x00\x00\x00\x00\x00\x47\x40\x00\x00\x00\x00\x00\x00)\x42\x40(\x00\x00\x80\x3f\x00\x00\x70\x42)|$1\x00\x00$2|sg' Spotlight
cmp -l Spotlight Spotlight.bak
sudo codesign -f -s - Spotlight
sudo killall Spotlight
The cmp -l
line should print out something like the following:
248855 0 102
248856 0 100
If it prints out nothing, then the patch failed. I have tested this on OS X 10.10.3 (Yosemite) and OS X 10.11.5 (El Capitan; SIP off).
What this patch is doing is replacing the status bar width value (36.0, or 0000000000004240 in floating-point hex) with zero, so that when the status bar item is loaded it simply renders with a width of zero, i.e. it is invisible and doesn't affect the layout of the bar.
Screenshot before doing this hack:

Screenshot after doing this hack:

Menu icon is gone but Cmd+Space continues to work.
To revert, do the following:
cd /System/Library/CoreServices/Spotlight.app/Contents/MacOS
sudo mv Spotlight.bak Spotlight
sudo killall Spotlight