104

I want to use either of apt-get or yum.

How to install them and make them successful running?

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
Karan-41317
  • 1,151
  • 2
    Why do you want to install them? What software do you want to install that you expect to find as .deb or .rpm files which will work on an OS X install? – user Jun 26 '13 at 11:08
  • 1
    Both utilities are too Linux-specific (and/or too Fedora/Debian-specific) so they won't work on OSX without serious effort on your part,so Michael's question stands: what exactly is it you want to do? – schaiba Jun 26 '13 at 11:30
  • 5
    obviously OP is asking about the equivalent -- seriously... – aequalsb Feb 12 '17 at 17:31
  • By the way, for installing SDKs (software development kits) such as Java JDK on macOS, I suggest using SDKMAN!, a slick set of shell scripts. – Basil Bourque Mar 25 '23 at 06:29

8 Answers8

94

If you want the equivalent of apt-get or yum on Mac OS X, you have two choices.

  1. Homebrew: http://brew.sh
  2. Macports: http://www.macports.org

You can use brew install PACKAGE_NAME or port install PACKAGE_NAME to install the package available.

prosseek
  • 8,558
  • 3
    There are guides on how to run Hombrew side-by-side with Macports or Fink, but it is generally recommended to choose one and stick with it. Homebrew is pretty much the standard these days. There is only a single instance I can recall personally, where a package I needed was available via Macports and not Homebrew, and that was an X11-based GUI browser -- Firefox, I believe, which would have been really nice to browse with over SSH in some specific localhost scenario I was working with at the time. It's just a personal preference thing, mostly. Homebrew is the best and most user-friendly, IMHO. – rubynorails Dec 12 '15 at 04:57
  • 10
    what is the exact syntax to install apt-get ? brew install apt-get gives "Error: No available formula with the name "apt-get" – Daniele Jun 14 '17 at 15:20
  • 1
    @Daniele idea here is brew install would be the equivalent of apt-get and not use apt-get through brew. – Gautam Jun 21 '19 at 07:44
  • @rubynorails you mentioned guides for installing homebrew side-by-side with Fink. Can you link me to one? I'm having trouble locating one – kraftydevil Jun 30 '19 at 01:32
  • 1
    @kraftydevil It has been 4 years since I posted this, and brew has become pretty much the standard as far as package managers go for MacOS. However, if you know how both package managers work and where all of the files live, I believe it should still be possible. https://stackoverflow.com/a/20889841 – rubynorails Jul 01 '19 at 15:29
11

You need to install either Homebrew or YUM. To install Homebrew enter the following command in terminal.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

then use brew install Package_name

KetZoomer
  • 103
8

It is possible to use apt-get on OS X 10.9 like Deb based Linux using a third party software named Fink - How to Install apt-get on Mac OS X. However, unlike Homebrew and OS X Package Managers, Fink does not use /usr/local/ path to install software. It simply means, Fink is for a bit advanced users who can handle the software conflicts (for difference in version). Homebrew, to me is the best package manager...

4

Installing Homebrew

Open terminal and type:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" `

Using Homebrew

Open terminal and do one of the following:

  • Installing casks (applications)
    brew cask install PKG
    
  • Installing kegs (command line tools and other packages)
    brew install PKG
    
  • Uninstalling kegs or casks (any packages)
    brew uninstall PKG
    
  • Uninstalling all kegs installed with homebrew
    brew uninstall /usr/local/Cellar/*
    
  • Searching for a package
    brew search PKG
    
  • List installed packages
    brew list
    
  • Replace PKG with the name of the package.

Uninstalling Homebrew

  • Big Sur, Catalina, and Mojave: Open terminal and type:
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
    
  • High Sierra, and earlier Open terminal and type:
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
    

Hope this helps!

AdminBee
  • 22,803
0

These are some other way

visit https://sdkman.io/

# you can use sdk install command to install software
$ sdk install package_name

examples:

MacdeMacBook-Pro$ sdk install java 8.0.191-oracle

Oracle requires that you agree with the Oracle Binary Code License Agreement
prior to installation. The license agreement can be found at:

http://www.oracle.com/technetwork/java/javase/terms/license/index.html

Do you agree to the terms of this agreement? (Y/n): Y

Downloading: java 8.0.191-oracle

In progress...
########################## 100.0%
We will be needing super powers...
Password:

Repackaging Java 8u191...
Attaching to the DMG...
Mounting DMG as Volume...
Volume(s) mounted successfully
Installing PKG inside DMG...
installer: Package name is JDK 8 Update 191
installer: Installing at base path /
installer: The install was successful.
Copy JDK Home to temp folder...
Preparing archive...
Unmounting volume...
"/Volumes/JDK 8 Update 191" unmounted successfully.
Done repackaging...
Cleaning up cookie...

Installing: java 8.0.191-oracle
Done installing!

Setting java 8.0.191-oracle as default.
MacdeMacBook-Pro:Homebrew mac$ java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
Daniele Santi
  • 4,137
  • 2
  • 30
  • 30
miazzy
  • 11
0

Homebrew and MacPorts are the better known alternatives, so i wont spend time on those here aswell.

I am a heavy Fedora/Centos user who recently had to learn how to get Mac os to behave as much as Linux as possible. I think the best package manager i have found is pkgsrc: available here https://pkgsrc.joyent.com/

Pkgsrc has some 20000 packages, 4x HomeBrew - give it a go :-)

0

Short answer is, you can use brew or macports on MacOS

To Install Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Using Homebrew commands:

Open terminal and do one of the following:

Installing casks (applications)

brew cask install <package>

Installing kegs (command line tools and other packages)

brew install <package>

Uninstalling kegs or casks (any packages)

brew uninstall <package>
Shaze
  • 119
  • 3
-1

install pkg

$ sdk install or i [version]

uninstall pkg

$ sdk uninstall or rm

list avaliable pkg

$ sdk list or ls [candidate] # $ sdk use or u [version] $ sdk default or d [version] $ sdk current or c [candidate] $ sdk upgrade or ug [candidate]

show current version of sdk manager

$ sdk version or v $ sdk broadcast or b $ sdk help or h $ sdk offline [enable|disable] $ sdk selfupdate [force] $ sdk update $ sdk flush

miazzy
  • 11
  • This doesn't answer the question at all. The question is specifically about getting APT or YUM working on OS X, not about the general usage of sdk. – TooTea Nov 29 '18 at 10:23
  • I agree with @TooTea. This makes no effort to answer the specific question. – Mig82 May 15 '19 at 08:49