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?

2
  • Haven't tested and seems that can be a little outdated, but the question is the same and the answer is marked and accepted. superuser.com/a/32802/375410
    – jherran
    May 12, 2015 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, 2015 at 17:43

6 Answers 6

39
+100

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
12
  • 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, 2015 at 0:23
  • 3
    Added those instructions.
    – nneonneo
    May 13, 2015 at 1:51
  • 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, 2015 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, 2015 at 16:04
  • 2
    Still valid for Sierra, although I had to temporarily disable System Integrity Protection (stackoverflow.com/a/32661637/1252653) to give me rights to duplicate the Spotlight executable.
    – tinystride
    Nov 25, 2016 at 23:36
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

3
  • 6
    I did say I didn't want to use Bartender in my question, but thanks for the pointer anyway.
    – nneonneo
    Nov 10, 2014 at 16:02
  • 5
    Does not work anymore in latest version of both (OSX and Bartender :-(
    – Strinder
    Jul 22, 2016 at 12:10
  • 2
    Update: Works if you go this way stackoverflow.com/questions/31640732/…
    – Strinder
    Jul 22, 2016 at 12:12
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.

8
  • 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. Oct 25, 2014 at 5: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, 2014 at 11:06
  • 1
    Okay, but I only want to remove the icon and not the functionality. Anyway, thanks. Oct 25, 2014 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, 2014 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, 2014 at 21:13
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/

3

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

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .