Software Installations Command-line Method Tuesday, August 09, 2011
Command-line Installation of Applications It is possible to install a.app,.dmg or.pkg file from the command line in a terminal window. To download an installation or image file from the web within the terminal you can use the curl command Ex: curl -O http://git-osx- installer.googlecode.com/files/git-1.7.3.4-x86_64- leopard.dmg This will drop the.dmg file into your current working directory. To copy an installation or image file from one machine to another use the scp command Ex: scp r Thunderbird.app user@machine:/path/to/file
Command-line mounting of.dmg 1. Mount the.dmg file with the hdiutil command 1. Ex: hdiutil attach Mac_OS_X_10.4_10.6_Kerberos_Extras.dmg Mounted.dmg files get added under the /Volumes directory. 2. Once mounted, the contents of the.dmg image can installed. 3. Detach the mounted volume when installation is complete. Ex: hdiutil detach /Volumes/MIT\ Kerberos\ Extras/
Command-line Installation of.(m)pkg Use the installer command to install.(m)pkg files Ex: sudo installer -pkg ~/Desktop/memtest\ 4.22.pkg/ -target / -pkg tells the installer command the location of the.(m)pkg file -target tells the installer the target *volume* to be installed to. The command line installation will not reboot the system post install. If reboot is needed this will need to be done manually.
Command-line Installation of.app Copy the.app directory to the /Applications directory Ex: sudo cp -a./thunderbird.app /Applications/ -a tells the copy command to preserve all file attributes and structures Be careful not to place a / at the end of the source directory. A trailing / will tell the cp command to copy everything inside the directory but not the directory itself.
Software Installations Macports Method http://guide.macports.org/
MacPorts MacPorts is an easy to use system for compiling, installing, and managing open source software, similar to Free BSD ports. A MacPorts port is a set of specifications contained in a Portfile that defines an application, its characteristics, and any files or special instructions required to install it. MacPorts is typically used to install different open source packages such as developer tools and libraries. Fink is a system similar to MacPorts which behaves more like a Linux package management tool but is very similar to MacPorts. http://www.finkproject.org/
MacPorts Advantages: Use a single command to tell MacPorts to automatically download, compile and install applications and libraries. Installs automatically any required support software, known as dependencies, for a given port. Provides for uninstalls and upgrades for installed ports. Confines ported software to a private sandbox that keeps it from intermingling with your operating system and its vendor-supplied software. Allows you to create pre-compiled binary installers of ported applications to quickly install software on remote computers without compiling from source code.
Installing MacPorts By default, MacPorts will not be installed unless running on versions previous to Snow Leopard (10.6). 1. Install X11 (if not already installed). 1. Insert the Mac OS X Install Disk and run the package named Optional Installs. 2. At the software selection window, expand the Applications category and click the check box beside X11 (and nothing else). 3. Click Install to install X11. 4. Select all the default options. 5. Note: If you do not have the OS disk handy you can download the package from http://xquartz.macosforge.org/trac/wiki/x112.5.0
2. Install Xcode Tools: Installing MacPorts 1. Download the Xcode tools: 1. From the App store. 2. From http://developer.apple.com/xcode/. You must register as a developer with Apple before downloading. 3. Use your system CD 2. Install the package with the standard default options. 3. Run system update to patch product.
3. Install MacPorts: Installing MacPorts 1. Download the latest.dmg file from http://distfiles.macports.org/macports/ and launch the installer. Select the easy install. Note: If you want to install from source see: http://guide.macports.org/#installing.macports.source This process is a bit more complicated and beyond the scope of this presentation. 2. The MacPorts installer will need to set some variables for your terminal window. If you have a pre-existing.profile or.bashrc file be sure to copy the contents into the newly created file.
Using MacPorts To list the currently available version of the specified port: port list <port_name> To search for a port: port search <like port_name> To get information about a port: port info <port_name> To install a port: sudo port install <port_name>
Using MacPorts To remove intermediate files that MacPorts creates while building a port: sudo port clean --all <port_name> To uninstall a specified port: sudo port uninstall <port_name> To display the files installed by a given port: port contents <port_name> To display the installed versions, variants and activation status of the specified ports: port v installed <port_name>
Using MacPorts To update MacPorts itself: sudo port selfupdate View outdated ports: port outdated To upgrade a specified port: sudo port upgrade <port_name> To upgrade all ports: sudo port upgrade outdated