Script To Download And Install Program On Mac UPDATED
Script To Download And Install Program On Mac
Introduction
The command line interface is a non-graphical way to interact with your computer. Instead of clicking buttons with your mouse, you'll type commands as text and receive text-based feedback. The command line, also known equally a shell, lets y'all automate many tasks you do on your calculator daily, and is an essential tool for software developers.
While the command line interface on macOS has a lot of the functionality yous'd find in Linux and other Unix systems, it does not send with a package manager. A package manager is a collection of software tools that work to automate software installations, configurations, and upgrades. Parcel managers go along the software they install in a central location and can maintain all software packages on the system in formats that are commonly used.
Homebrew is a packet manager for macOS which lets you install complimentary and open-source software using your terminal. You'll use Homebrew to install developer tools like Python, Ruby, Node.js, and more.
In this tutorial you'll install and utilize Homebrew on your Mac. You lot'll install arrangement tools and desktop applications from the command line interface.
Prerequisites
You will demand a macOS calculator running Catalina or higher with administrative admission and an cyberspace connection. While older versions of macOS may work, they are non officially supported.
Step 1 — Using the macOS Terminal
To access the command line interface on your Mac, you'll use the Terminal application provided past macOS. Like any other application, yous can detect information technology by going into Finder, navigating to the Applications binder, and and then into the Utilities folder. From hither, double-click the Final awarding to open it upwards. Alternatively, you tin can use Spotlight by holding down the COMMAND key and pressing Infinite to find Final by typing it out in the box that appears.
To get more comfy using the control line, have a look at [An Introduction to the Linux Terminal] (https://world wide web.digitalocean.com/community/tutorials/an-introduction-to-the-linux-terminal). The command line interface on macOS is very like, and the concepts in that tutorial are directly applicative.
Now that you take the Last running, let's install some boosted tools that Homebrew needs.
Xcode is an integrated development surroundings (IDE) that is comprised of software development tools for macOS. Y'all won't need Xcode to use Homebrew, merely some of the software and components you'll desire to install will rely on Xcode'due south Command Line Tools packet.
Execute the following command in the Terminal to download and install these components:
- xcode-select --install
You lot'll exist prompted to beginning the installation, then prompted again to have a software license. Then the tools volition download and install automatically.
You lot can now install Homebrew.
Stride 3 — Installing and Setting Upwards Homebrew
To install Homebrew, you'll download an installation script and then execute the script.
First, download the script to your local machine past typing the following command in your Concluding window:
- curl -fsSL -o install.sh https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh
The command uses coil to download the Homebrew installation script from Homebrew's Git repository on GitHub.
Permit's walk through the flags that are associated with the curl command:
- The -
for--neglectflag tells the Terminal window to give no HTML document output on server errors. - The
-due southor--silentflag mutesrolland so that it does not show the progress meter, and combined with the-Southor--show-errorflag it will ensure thatcurlshows an fault message if it fails. - The
-Lor--locationflag will tellwhorlto handle redirects. If the server reports that the requested page has moved to a dissimilar location, it'll automatically execute the request again using the new location. - The
-oswitch specifies a local filename for the file. Rather than displaying the contents to the screen, the-oswitch saves the contents into the file you lot specify.
Before running a script you've download from the Internet, yous should review its contents so you know what the script volition do. Use the less command to review the installation script so y'all understand what information technology will do"
- less install.sh
Once you lot're comfortable with the contents of the script, execute the script with the fustigate command:
- /bin/bash install.sh
The installation script will explicate what information technology will practice and will prompt you to ostend that you lot want to do it. This lets you know exactly what Homebrew is going to do to your system before y'all let it go on. It also ensures yous have the prerequisites in place before it continues.
You'll be prompted to enter your password during the process. Nevertheless, when you type your password, your keystrokes will not display in the Terminal window. This is a security measure and is something you'll see often when prompted for passwords on the control line. Even though you don't see them, your keystrokes are beingness recorded past the system, so press the RETURN key one time you lot've entered your password.
Press the alphabetic character y for "yes" whenever you are prompted to confirm the installation.
In one case the installation process is consummate, yous volition want to put the directory Homebrew uses to store its executables at the front of the PATH environment variable. This ensures that Homebrew installations volition exist chosen over the tools that macOS includes.
The file you'll alter depends on which beat y'all're using. ZSH is the default shell on macOS Mojave and college. The Bash shell is a pop shell that older versions of macOS used as the default, and if you've upgraded your OS, you may still be using Bash.
Execute the following command to decide your shell:
- echo $0
You'll encounter either bash or zsh.
If yous're using ZSH, you'll open the file ~/.zshrc in your editor:
- nano ~/.zshrc
If you're using the Fustigate shell, you'll utilize the file ~/.bash_profile:
- nano ~/.bash_profile
Once the file opens up in the Terminal window, add the following lines to the terminate of the file:
~/.zshrc
# Add together Homebrew'south executable directory to the front of the PATH consign PATH =/usr/local/bin:$PATH The first line is a comment that will help you remember what this does if you open up this file in the future.
To save your changes, hold down the CTRL key and the letter O, and when prompted, press the RETURN key. And so go out the editor by holding the CTRL fundamental and pressing 10. This will return you to your Terminal prompt.
To activate these changes, shut and reopen your Terminal app. Alternatively, utilise the source command to load the file you modified.
If yous modified .zshrc, execute this command:
- source ~/.zshrc
If you modified .bash_profile, execute this command:
- source ~/.bash_profile
Once yous have washed this, the changes you have made to the PATH environment variable volition have effect. They'll be set correctly when you lot log in once again in the future, as the configuration file for your shell is executed automatically when you open up the Terminal app.
Now permit's verify that Homebrew is set up correctly. Execute this control:
- mash doctor
If no updates are required at this time, you'll meet this in your Concluding:
Output
Your organisation is set up to mash. Otherwise, you may go a warning to run another command such as brew update to ensure that your installation of Homebrew is up to date. Follow any on-screen instructions to fix your environs before moving on.
Step 4 — Installing, Upgrading, and Removing Packages
Now that Homebrew is installed, utilize it to download a package. The tree command lets you lot see a graphical directory tree and is available via Homebrew.
Install tree with the mash install command:
- mash install tree
Homebrew will update its list of packages and and then download and install the tree command:
Output
Updating Homebrew... ==> Downloading https://homebrew.bintray.com/bottles/tree-ane.8.0.catalina.bottle.tar.gz ######################################################################## 100.0% ==> Pouring tree-1.8.0.catalina.bottle.tar.gz 🍺 /usr/local/Cellar/tree/one.8.0: 8 files, 117.2KB Homebrew installs files to /usr/local by default, so they won't interfere with future macOS updates. Verify that tree is installed by displaying the command's location with the which command:
- which tree
The output shows that tree is located in /usr/local/bin:
Output
/usr/local/bin/tree Run the tree command to see the version:
- tree --version
The version prints to the screen, indicating information technology'due south installed:
Output
tree v1.8.0 (c) 1996 - 2018 by Steve Bakery, Thomas Moore, Francesc Rocher, Florian Sesser, Kyosuke Tokoro Occasionally, you'll want to upgrade an existing package. Use the brew upgrade command, followed past the parcel name:
- brew upgrade tree
You lot can run brew upgrade with no boosted arguments to upgrade all programs and packages Homebrew manages.
When you install a new version, Homebrew keeps the older version around. After a while, you might want to reclaim disk space by removing these older copies. Run brew cleanup to remove all old versions of your Homebrew-managed software.
To remove a package you're no longer using, utilize brew uninstall. To uninstall the tree command, execute this control:
- brew uninstall tree
The output shows that the package was removed:
Output
Uninstalling /usr/local/Cellar/tree/1.8.0... (viii files, 117.2KB) Y'all tin use Homebrew to install desktop applications too.
Step 5 — Installing Desktop Applications
You're non restricted to using Homebrew for control-line tools. Homebrew Cask lets you install desktop applications. This feature is included with Homebrew, so there's nil additional to install.
Test it out by using Homebrew to install Visual Studio Lawmaking. Execute the following command in your concluding:
- brew install visual-studio-code
The awarding will install:
Output
==> Downloading https://update.lawmaking.visualstudio.com/one.58.2/darwin/stable ==> Downloading from https://az764295.vo.msecnd.net/stable/c3f126316369cd610563c75b1b1725e0679adfb3/VSCode-darwin.zip ######################################################################## 100.0% ==> Installing Cask visual-studio-code ==> Moving App 'Visual Studio Code.app' to '/Applications/Visual Studio Code.app' ==> Linking Binary 'code' to '/usr/local/bin/code' 🍺 visual-studio-code was successfully installed! Y'all'll detect the awarding in your Applications folder, just as if you'd installed it manually.
To remove information technology, use mash uninstall:
- mash uninstall visual-studio-code
Homebrew will remove the installed software:
Output
==> Uninstalling Cask visual-studio-code ==> Bankroll App 'Visual Studio Lawmaking.app' up to '/usr/local/Caskroom/visual-studio-code/1.58.2/Visual Studio Lawmaking.app' ==> Removing App '/Applications/Visual Studio Code.app' ==> Unlinking Binary '/usr/local/bin/code' ==> Purging files for version 1.58.ii of Cask visual-studio-code Information technology performs a backup first in case the removal fails, simply once the program is fully uninstalled, the backup is removed too.
Footstep 6 — Uninstalling Homebrew
If you no longer need Homebrew, you tin can utilize its uninstall script.
Download the uninstall script with scroll:
- gyre -fsSL -o uninstall.sh https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh
As always, review the contents of the script with the less command to verify the script's contents:
- less uninstall.sh
One time you've verified the script, execute the script with the --assist flag to come across the various options you can utilise:
- bash uninstall.sh --help
The options brandish on the screen:
Output
Homebrew Uninstaller Usage: uninstall.sh [options] -p, --path=PATH Sets Homebrew prefix. Defaults to /usr/local. --skip-cache-and-logs Skips removal of HOMEBREW_CACHE and HOMEBREW_LOGS. -f, --force Uninstall without prompting. -q, --quiet Suppress all output. -d, --dry-run Simulate uninstall simply don't remove anything. -h, --help Brandish this message. Use the -d flag to see what the script volition practice:
- bash uninstall.sh -d
The script will list everything it volition delete:
Output
Warning: This script would remove: /Users/brianhogan/Library/Caches/Homebrew/ /Users/brianhogan/Library/Logs/Homebrew/ /usr/local/Caskroom/ /usr/local/Cellar/ /usr/local/bin/brew -> /usr/local/bin/brew ==> Removing Homebrew installation... Would delete: .... When you're ready to remove everything, execute the script without any flags:
- bash uninstall.sh
This removes Homebrew and any programs yous've installed with it.
Conclusion
In this tutorial you installed and used Homebrew on your Mac. You can at present utilize Homebrew to install command line tools, programming languages, and other utilities you'll demand for software development.
Homebrew has many packages you tin install. Visit the official listing to search for your favorite programs.
DOWNLOAD HERE
Posted by: patriciarecare.blogspot.com
