Install Watch Command on OS X

Aug 22, 2010 - 17 Comments

Terminal in OS X If there was one command I would really complain about not being on Mac OS X, it would be “watch”. Watch is one of those great pieces of software that is tiny and completely out of the way, but when needed it will be a life saver. We’re going to show you three different ways to install the watch command; through a precompiled binary, with HomeBrew, and with MacPorts. Plus, we’ll show you a little about how to use watch and why it’s useful.

What is ‘watch’ and how does it work?

What is the watch command? For the unfamiliar, it’s simple to explain watch; Watch will run a command repeatedly and then display the output in an “ncurses” friendly manner. Another way to explain this might be to say, you can turn any command line program output into a “real time” display. A good example is using watch to monitor disk usage.

Now of course it’s hard to demonstrate the command running in a repetitive manner using a still image, but this might be something you would want to run when monitoring the amount of space left on your hard drive while transferring a large file(s). If you examine the screen shot closely, in the upper left hand corner you will notice that the command is being run every 5.0s, or 5 seconds. The command being run, is “df -kh”. The output tells us the disk size, used space, available space and percentage used (capacity) in a human readable format (thats what the “h” stands for in df -kh). As we delete a large portion of files, or copy new files to our computer we will see these values change. If you wanted to see smaller increments you would remove the “h” and just run “df -k”.

The basic usage for watch is: watch -n number_of_seconds “command”

So, watch is pretty great. Let’s get watch working on your Mac.

Screen shot 2010-06-09 at 8.25.23 PM

How to Install & Run Watch in OS X

As mentioned, we have three choices; installing watch as a precompiled binary, installing watch with Homebrew, or installing Watch with MacPorts. The precompiled binary will work if you do not have homebrew or ports installed in OS X.

Download the precompiled “watch” command from
We are using “curl”, a command line “browser”, this will download watch to your Mac, but if you want you can use MacPorts or Homebrew to install watch as well, which are shown below:
curl -O

Make “watch” executable
By doing this we tell Mac OS that this is a program that can run
chmod +x watch

Test the program
Let’s make sure everything is in working order.

Install “watch”
Optional: By following this next step we are placing watch into a system location that will allow you to run it from any location in the Terminal (You will be prompted for your password)
sudo mv watch /usr/local/bin/

Congrats, you have added the watch command to your Mac OS X System.

Installing Watch in OS X with Homebrew or MacPorts

If you’re a user of HomeBrew or MacPorts, you can also install watch through those tools:

For Homebrew, install the watch command with:

brew install watch

For MacPorts, you can install watch with:

sudo port install watch

Both of these will also install watch onto the Mac, use whichever approach you are comfortable with. With either Homebrew or Macports, you can simply type ‘watch’ after the install has been completed to run the command.

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: chrisk in Command Line, Mac OS X, Tips & Tricks


» Comments RSS Feed

  1. Greg says:

    Thanks, very useful.

  2. This would be perfect for using with GeekTool!

  3. Testie says:


  4. nissan says:

    This is nice one.

  5. laJalame says:

    sudo port install watch


  6. up0 says:

    This is a life-saver!!! I’ve been running mac and Linux all this time and even I didn’t know about ‘watch’… I’ve been looking for a real-time display app… something like htop/top but for other app on the shell.

  7. Fink provides `watch’ and a bunch of other useful command line utilities. See and

  8. Matthias says:

    ehh, download a file from somewhere you haven’t even mentioned before in the post and make it executable, then run it. It’s like the world’s most straight forward virus. I know, it probably isn’t, but one wouldn’t know either way.

    You’d probably be safer with macports or fink.

  9. […] useful when combined with the Unix watch command (if you’re on OS X, you may have to install it manually), which reruns the command periodically so you can see how things are changing in […]

  10. Mark says:

    Am I mistaken or is there no possibility to use the pipe with this ‘watch’? I tried “ls -hal | grep something” and it returned “h | grep command not found”.

  11. JDogg says:

    Use single or double quotes to surround your watch command.

    watch “ls -hal | grep something”

  12. braz says:

    Very helpful, thanks. However, the install command does not appear to work for me. The directory is not recognized.

  13. Zeke says:

    or you compile it yourself…
    make watch PKG_LDFLAGS=-Wl

    why the hassle? the precompiled binary is not working on legacy power pc systems…

  14. Tom says:

    Great little tech note, thanks!

  15. Sam Bowne says:

    On OS X 10.8.2, there is no /usr/local/bin directory. Putting it in /usr/bin instead works.

    Thanks for this!

  16. Rangi says:

    Fantastic, thanks!

  17. Davi says:

    Great tip. Another option is to use this little bash script which I found on a guys website, can’t remember the name of the author but it has been in my .profile for a long time:

    put this into a file ‘diywatch’:

    #!/usr/bin/env bash
    # usage: diywatch [command] [sleep duration]
    while :; do
    bash -c "$1"
    sleep ${2:-1}

    Then chmod +x diywatch

    Then ./diywatch

    Works basically the same as watch, great little tip. If you know the original creator, tell htem thanks!

Leave a Reply


Shop for Apple & Mac Deals on

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates