How to update macbook pro from terminal

Hi,

I want to help my friend. They have 10 Apple macbook pros. I have enabled ssh on macbook pro. Can I update those using a shell script? How to update macOS based macbook pro using a simple terminal command line option? Is there such tool available macos bash shell?

Any help would be much appreciated.

Open the terminal app and run the following command to see updates list:

softwareupdate -l

To apply updates simply run:

sudo softwareupdate -r
sudo softwareupdate -i -a

You can use bash for loop as follows from your terminal over ssh:

for i in mac1 mac2 mac3 mac10
do
   ssh -t user@${i} sudo softwareupdate -i -a
done

For more info see my FAQ:

1 Like

Hi,

  1. Launch the Terminal application (which can be found in the /Applications/Utilities folder.

  2. From the Terminal, type softwareupdate -l (that’s a lowercase “L” and not the number one). This will provide a list of all available updates along with their individual file sizes and a note indicating whether you’ll need to restart your Mac to complete the update process.

  3. To install an individual software update, enter the command sudo softwareupdate -i name , where “name” is the exact name of one of the available updates revealed by the list command.
    command, you’ll need to enter your admin account password when prompted.

  4. To install all available software updates, instead use the command sudo softwareupdate -i -a . The “-a” switch simply instructs the command to install all updates. Again, you’ll need to enter your admin password when prompted.

  5. There’s no traditional progress bar, but you will see updated text entries in the Terminal window as each step is completed, letting you know both when certain updates have been downloaded and when the entire installation process is complete. If you installed software updates that require a reboot, you’ll see a final message instructing you to restart your Mac.

Dafont 192.168.1.1