What is the difference between Linux (Ubuntu) and Mac shell commands?

I use Ubuntu at work and a Mac at home.

I was trying out some shell commands on my bash terminal on the Mac today but they didn't work. I was told both machines should operate UNIX commands so the terminal commands should be the same.

However I can't use apt-get install among other commands. Why is that?

What should I type on a Mac instead of apt-get? Is there anyway to use the same commands on both systems?


This is a very simplified answer, but it's basically accurate.

The commands that don't work on the Mac terminal are programs that the Mac doesn't have. You can find equivalents for most of them, but apt-get is the Ubuntu package manager so you won't find it on OS X. As far as I know, OS X doesn't even have a package manager.


You seem to possible be aware that you are using the same shell on both Ubuntu and Mac OS X (that is BASH). But apt-get is not a "shell command", whatever that might be. apt-get is simply a program, and more specifically it is package management software used under Debian related Linux distributions (like Ubuntu). Of course it is available to use under other Linux distributions.

So the reason it's not available for you to type in your terminal at work is simply because it is not present on a Mac. As others have mentioned Mac OS X does not follow the package distribution model as Linux does. You find those weird .dmg files or whatever Macs normally use to install applications. However there are similar distribution type systems available for Mac like MacPorts. Using Macports you follow a similar command interface to apt-get to install things

port install package

Follow MacPorts documentation for the rest.

Anything that is a shell built-in will be available under both Ubuntu/Mac (even moreso BASH specific things since they are the same shell), but the plethora of programs that you might expect in a Linux distro (i.e. coreutils and other GNU related stuff) is not going to be present.