65

I use Spotlight in OS X, and I have long disliked its attachment to the menu bar.

Now, in Yosemite, Spotlight shows up as an overlay in the middle of the screen when summoned, much like other launcher utilities like Quicksilver or Alfred. But the Spotlight icon is still stuck in my menubar, even though clicking it now shows a totally detached overlay.

The traditional way to disable the search icon (chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search) also disables Spotlight completely. I want to keep Spotlight functionality, but kill the (now useless) menubar icon, since I can summon Spotlight with Cmd+Space.

I've also tried Bartender, which works but is both pricey ($15 to remove an icon!) and quirky (it takes a while to startup, so my menu bar ends up shifting around for up to a minute after logging in)

What's the best way to remove the Spotlight icon?

nneonneo
  • 2,100
  • Haven't tested and seems that can be a little outdated, but the question is the same and the answer is marked and accepted. http://superuser.com/a/32802/375410 – jherran May 12 '15 at 17:26
  • 1
    @jherran: That doesn't solve the problem, unfortunately. I still want to be able to use Cmd+Space to launch the Spotlight overlay. – nneonneo May 12 '15 at 17:43

6 Answers6

39

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:

before hack

Screenshot after doing this hack:

after 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
nneonneo
  • 2,100
  • This looks really awesome, but for the less Terminal-literate among us, can you please add instructions on how to revert back to normal if we're ever so inclined? – user24601 May 13 '15 at 00:23
  • 3
    Added those instructions. – nneonneo May 13 '15 at 01:51
  • Is it just me, or does doing this result in a loss of Spotlight functionality? After doing this, Spotlight won't search Maps, Contacts, or do unit conversions, and that's just what I've noticed so far. Please let me know if there's a fix! – user24601 May 14 '15 at 03:49
  • Interesting...I tested this and it seems to be the same problem over here. I'm not sure what's wrong, though I suspect the codesigning is at fault. Maybe it needs a particular provision... – nneonneo May 14 '15 at 05:05
  • Any idea how to get that functionality back? – user24601 May 14 '15 at 13:08
  • 1
    After this spotlight doesn't start anymore. $ codesign -f -s - Spotlight Spotlight: replacing existing signature Spotlight: bundle format unrecognized, invalid, or unsuitable – Rnhmjoj Jun 18 '15 at 17:20
  • 1
    Spotlight: replacing existing signature Spotlight: bundle format unrecognized, invalid, or unsuitable In subcomponent: /System/Library/CoreServices/Spotlight.app/Contents/XPCServices/com.apple.metadata.SpotlightNetHelper.xpc – Jarno Sep 28 '15 at 16:04
  • OS X 10.10.5 btw – Jarno Sep 28 '15 at 16:04
  • is this still valid for sierra? – Martin Mlostek Oct 14 '16 at 09:28
  • 2
    Still valid for Sierra, although I had to temporarily disable System Integrity Protection (http://stackoverflow.com/a/32661637/1252653) to give me rights to duplicate the Spotlight executable. – tinystride Nov 25 '16 at 23:36
  • Does it work in high sierra? – vr3C Jun 20 '18 at 06:49
  • @nneonneo any idea if this works with macOS Cataline? (writing on 5/31/2020) – MmmHmm May 31 '20 at 16:16
17

I'd recommend using the utility app called Bartender. http://www.macbartender.com

This is a handy utility to manage and change the way menu bar icons are displayed. You can leave them in the menu bar, have them dropped down into the bartender bar which itself is opened via a small icon in your menu bar, but can hold any of the icons normally in the menu bar, or hide the icon altogether.

You can see a screenshot here:

enter image description here

Ian C.
  • 45,969
Ali Samii
  • 877
12

I ended up removing the icon and Spotlight Search functionality and now I use Alfred instead ; it's faster and it is free (with paying extension that you mostly don't need).

Removing the Spotlight visible application (and the icon) the indexation services are not stopped, only the graphical user interface is stopped i.e. both the icon in the top menu top bar and the Search window when + Space. This is why you need another application to access these indexes, such as Alfred.

So the following command that changes the permission to make Search not executable.

sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search

as said it does not completely disable spotlight, it only removes a the graphical user interface of Spotlight.

Logging out and in may be sufficient, if not just reboot.


You can revert it with this command

sudo chmod 755 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search

Same here you have to log out or restart.

This method is still working with 10.10.3.


This method is probably not exactly what the question asked but it has the merit to limit the manipulation screw ups. Just changing the files permissions is way easier than changing the binary of a program. to just to don't show the Spotlight icon the binary of Spotlight.

bric3
  • 604
  • 6
  • 17
  • 4
    I did this (in Yosemite), but now I cannot trigger spotlight with the keyboard shortcut also! I had to sudo chmod 755 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search & killall SystemUIServer to revert back. – Rahul Thakur Oct 25 '14 at 05:04
  • @RahulThakur Yeah that's the point of the answer, alfred becomes the main search tool, but it uses spotlight indexes. Also with Alfred there's an option to be launched with ctrl+space – bric3 Oct 25 '14 at 11:06
  • 1
    Okay, but I only want to remove the icon and not the functionality. Anyway, thanks. – Rahul Thakur Oct 25 '14 at 12:35
  • OK. Bartender maybe the best option then. But you may definitely want to give a try to alfred. Especially regarding the information Apple is leaking when using spotlight. – bric3 Oct 25 '14 at 15:00
  • Just chiming in that this killed Spotlight completely for me and had to use sudo chmod 755 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search and reboot to fix it. – Dillon Oct 31 '14 at 21:13
  • @Patience No, that stop the UI interface, not the indexation, that is being used by other programs, which is indeed described in the comments. I'll update the answer to reflect that. – bric3 Oct 31 '14 at 22:42
  • This does not work for me on Yosemite. 10.10.2 –  Feb 27 '15 at 05:38
  • For those wondering whether Alfred can do its own indexing, the answer is no. Alfred relies on Spotlight's indexing, and if disabled, you'll need to reindex your Mac. – Dennis Jan 31 '17 at 14:54
5

A simple and broader solution to this problem is to hide icons in the menu bar with Vanilla, which is a free utility developed by Matthew Palmer and has the same core functionality as Bartender, but in a more minimalist package.

http://matthewpalmer.net/vanilla/

juil
  • 244
  • 4
  • 10
3

Dozer is another app to do so that is completely free, unlike Bartender or Vanilla.

xji
  • 2,018
3

In macOS Big Sur, this can be done easily:

  1. Open System Preferences.
  2. Go to Dock & Menu Bar -> Spotlight.
  3. Uncheck Show in Menu Bar.

Spotlight

Igor
  • 236
  • Yay, finally an officially supported option! I guess I will have to upgrade to Big Sur eventually :) – nneonneo May 30 '21 at 19:55