5

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?

3 Answers 3

9

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.

2
  • 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... Jul 27, 2011 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, 2011 at 13:26
3

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.

0

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?

You must log in to answer this question.

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