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.

| improve this answer | |
  • 3
    OS X doesn't come with a package manager, and they don't really fit with OS X's philosophy of software installation. Nonetheless, there are package managers available for OS X: homebrew, MacPorts, and fink (though I've heard fink isn't very well maintained recently). Of course, none of them use the apt-get command... – Gordon Davisson Jul 27 '11 at 3:29
  • I didn't know about any of those. Thanks! Of course, if someone is dead-set on using the apt-get command you can always create an alias though providing all the other functions would be trickier. – Yitzchak Jul 27 '11 at 13:26

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.

| improve this answer | |

MacPorts is a somewhat similar experience to apt-get, though it's actually derived from FreeBSD's "ports" system. You'll only use this to install and upgrade open-source software, of course, and that's mostly terminal stuff.

A lot of UNIX commands work in OSX, but UNIX has always been a fragmented world with differences between each version of it. Are there any other specific commands that have been giving you trouble?

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.