Menu
These advanced steps are primarily for system administrators and others who are familiar with the command line. You don't need a bootable installer to upgrade macOS or reinstall macOS, but it can be useful when you want to install on multiple computers without downloading the installer each time.
The Windows Terminal is a modern, fast, efficient, powerful, and productive terminal application for users of command-line tools and shells like Command Prompt, PowerShell, and WSL. Its main features include multiple tabs, panes, Unicode and UTF-8 character support, a GPU accelerated text rendering engine, and custom themes, styles,. Using the Terminal is the best way to allow installation of applications on your Mac without the tedious process involved in making exceptions for each one of them. Using this method, you can install and use applications as you wish regardless of their source. Opening apps from unidentified developers are not for everyone. Download and install a.dmg file from Mac OS terminal. I created a bash piece of code that downloads a.dmg. For example, for installing alfred.app. Mar 21, 2018 How to open Terminal on Mac. The Terminal app is in the Utilities folder in Applications. To open it, either open your Applications folder, then open Utilities and double-click on Terminal, or press Command - spacebar to launch Spotlight and type 'Terminal,' then double-click the search result.
What you need to create a bootable installer
- A USB flash drive or other secondary volume, formatted as Mac OS Extended, with at least 12GB of available storage
- A downloaded installer for macOS Big Sur, Catalina, Mojave, High Sierra, or El Capitan
Download macOS
- Download: macOS Big Sur, macOS Catalina, macOS Mojave, or macOS High Sierra
These download to your Applications folder as an app named Install macOS [version name]. If the installer opens after downloading, quit it without continuing installation. To get the correct installer, download from a Mac that is using macOS Sierra 10.12.5 or later, or El Capitan 10.11.6. Enterprise administrators, please download from Apple, not a locally hosted software-update server. - Download: OS X El Capitan
This downloads as a disk image named InstallMacOSX.dmg. On a Mac that is compatible with El Capitan, open the disk image and run the installer within, named InstallMacOSX.pkg. It installs an app named Install OS X El Capitan into your Applications folder. You will create the bootable installer from this app, not from the disk image or .pkg installer.
Use the 'createinstallmedia' command in Terminal
- Connect the USB flash drive or other volume that you're using for the bootable installer.
- Open Terminal, which is in the Utilities folder of your Applications folder.
- Type or paste one of the following commands in Terminal. These assume that the installer is in your Applications folder, and MyVolume is the name of the USB flash drive or other volume you're using. If it has a different name, replace
MyVolume
in these commands with the name of your volume.
Big Sur:*
Catalina:*
Mojave:*
High Sierra:*
El Capitan:
* If your Mac is using macOS Sierra or earlier, include the
--applicationpath
argument and installer path, similar to the way this is done in the command for El Capitan.After typing the command:
- Press Return to enter the command.
- When prompted, type your administrator password and press Return again. Terminal doesn't show any characters as you type your password.
- When prompted, type Y to confirm that you want to erase the volume, then press Return. Terminal shows the progress as the bootable installer is created.
- When Terminal says that it's done, the volume will have the same name as the installer you downloaded, such as Install macOS Catalina. You can now quit Terminal and eject the volume.
Use the bootable installer
After creating the bootable installer, follow these steps to use it:
- Plug the bootable installer into a Mac that is connected to the internet and compatible with the version of macOS you're installing.
- Press and hold the Option (Alt) ⌥ key immediately after turning on or restarting your Mac.
- Release the Option key when you see a dark screen showing your bootable volumes.
If you can't start up from the bootable installer, make sure that the External Boot setting in Startup Security Utility is set to allow booting from external media. - Choose your language, if prompted.
- Select Install macOS (or Install OS X) from the Utilities window, then click Continue and follow the onscreen instructions.
Learn more
For more information about the
createinstallmedia
command and the arguments that you can use with it, make sure that the macOS installer is in your Applications folder, then enter the appropriate path in Terminal:- Big Sur: /Applications/Install macOS Big Sur.app/Contents/Resources/createinstallmedia
- Catalina: /Applications/Install macOS Catalina.app/Contents/Resources/createinstallmedia
- Mojave: /Applications/Install macOS Mojave.app/Contents/Resources/createinstallmedia
- High Sierra: /Applications/Install macOS High Sierra.app/Contents/Resources/createinstallmedia
- El Capitan: /Applications/Install OS X El Capitan.app/Contents/Resources/createinstallmedia
An intrepid reader asked the following question:
How do you install a .dmg package from the command line?
Many applications are distributed as disk images, a compressed binary format. If you double click a disk image in the Finder, it is mounted automatically. Once mounted, installation of the application is typically done by dragging an icon to the Applications folder. The same can be accomplished from the command line using two commands,
hdiutil
and cp
. The following steps show the installation of a popular VNC client for OS X called 'Chicken of the VNC'. It can be used as a remote desktop client for Linux, Mac, or Windows hosts.
The download file is named 'cotvnc-20b4.dmg'. Here are the steps needed to install it remotely from the command line.
note: this technique can be used from a local Terminal window or a remote SSH connection.
note: this technique can be used from a local Terminal window or a remote SSH connection.
Mount the disk image
The first step is to mount (or attach) the disk image. From the command line, use:
I received the following output:
hdiutil mount cotvnc-20b4.dmg
I received the following output:
A mounted disk image appears on the Desktop, in the Finder, and more importantly shows up as a directory in /Volumes. In this case, the last line of output from hdiutil showed exactly where the disk image was mounted.
Sometimes when a disk image is mounted, it will prompt you to agree to a license first. In that case, the text that would normally appear in a GUI dialog box instead appears in the Terminal window. Once you scroll to the bottom of the agreement, you can type in Y to continue or N to stop. The Firefox disk image is one example of a package that displays a license before mounting.
![Application Application](https://www.howtogeek.com/thumbcache/2/200/96201f689f7f484ff86882905f5ca263/wp-content/uploads/2017/01/mas-featured.png)
Install the application
Use the
cp
command to copy the application to /Applications:sudo cp -R '/Volumes/Chicken of the VNC/Chicken of the VNC.app' /Applications
See More Results
The
-R
switch means to copy recursively, in other words, copy everything from that location including all subdirectories and files below. It is important to leave off the trailing '/' from the 'Chicken of the VNC.app' directory, or the command will not copy the directory itself, just the contents. After entering your password, the application will be installed and ready to use. Most applications can simply be copied to the /Applications directory. However, some are distributed in a .pkg format and must be installed using the
installer
command instead of cp
. To install a .pkg, use this command:sudo installer -package /path/to/package -target '/Volumes/Macintosh HD'
Unmount the disk image
To tidy up, return to your home directory and unmount the disk image:
cd ~
hdiutil unmount '/Volumes/Chicken of the VNC/'
You should see this message after the unmount:
'/Volumes/Chicken of the VNC/' unmounted successfully.
Macos - Installing Mavericks Via Terminal - Ask Different
Installing applications from a .dmg package at the command line is not something you need to do every day. But it is a nice tool to have if you want to install an application on a remote server or script the installation of a package to a group of desktop Macs.