Blog Post

Folosește OSX Terminal ca să lucrezi cu system updates

Nov. 6, 2016, 2:54 p.m. osx


Update-urile OSX au devenit pentru mine aproape la fel de enervante (notificările) și deopotrivă necesare (securitate și bug fixuri) încât am deja-vu-uri din perioada Windows XP ante-service-pack.

Comanda supremă este softwareupdate

Listează update-urile disponibile:

MB:~ eu$ softwareupdate -l
Software Update Tool
Copyright 2002-2015 Apple Inc.

Finding available software
Software Update found the following new or updated software:
   * Security Update 2016-002-10.11.6
    Security Update 2016-002 (10.11.6), 408734K [recommended] [restart]
   * Safari10.0.1ElCapitan-10.0.1
    Safari (10.0.1), 68803K [recommended] [restart]
   * iTunesXPatch-12.5.3
    iTunes (12.5.3), 108312K [recommended]

Instalează TOATE update-urile disponibile:

MB:~ eu$ sudo softwareupdate -iva

Instalează update-urile recomandate/critice (atenție că trebuie să dai și restart, și chiar dacă Mac-ul face treabă bună la session restore, atunci când aveți o groază de ferestre și tab-uri deschise o să vă cam rupă din flow, noroc că în terminal nu face restart de capul lui!):

MB:~ eu$ sudo softwareupdate -irv
Software Update Tool
Copyright 2002-2015 Apple Inc.

Finding available software

Downloaded Security Update 2016-002
Downloaded Safari
Installing Security Update 2016-002, Safari
   Progress: 2%
# durează un pic, bea un ceai sau o BR
   Progress: 100%
Done with Security Update 2016-002
Done with Safari
Done.

You have installed one or more updates that requires that you restart your
computer.  Please restart immediately.

# Acum dacă te roagă așa frumos parcă îi dai voie:
MB:~ eu$ sudo shutdown -r now "Rebooting Now Băieții\!"
Password:

# Diacriticele merg, dar semnul exclamării trebuie dezactivat cu \ backshlash

# Partea cu ghilimele e pt băieții care sunt conectați la tine,
# odată am umblat vreo 2 luni cu firewall-ul dezactivat, era un bug cu conexiunea wifi la mac
# cică workround când ești liniștit în spatele router-ului acasă, da am uitat de el

Session Restored

Last login: Sun Nov  6 17:03:37 on console

Sau instalează un update din cele listate mai devreme:

MB:~ eu$ sudo softwareupdate -i TunesXPatch-12.5.3
Software Update Tool
Copyright 2002-2015 Apple Inc.

Downloaded iTunes
Installing iTunes
Done with iTunes
Done.

Sau ignoră un update din cele listate mai devreme:

MB:~ eu$ sudo softwareupdate --ignore TunesXPatch-12.5.3

Și dacă tot suntem aici, bagă repede și comnezile pt homebrew!

Fă update la homebrew:

MB:~ eu$ brew --version
Homebrew 1.0.9-67-gce2b11f
Homebrew/homebrew-core (git revision 9b610; last commit 2016-06-14)
MB:~ eu$ brew update
Updated 1 tap (homebrew/core).
==> New Formulae brew update
# multe formule...
==> Updated Formulae
# idem...
==> Renamed Formulae
commonmark -> cmark                   racket -> minimal-racket              stash-cli -> atlassian-cli
geode -> apache-geode                 sonar -> sonarqube                    wires -> geckodriver
==> Deleted Formulae
# ibidem (idem sau ibidem nu bag mâna în foc că le-am folosit corect aici, dar îmi era tare dor de ele, așa că pentru mai mare siguranță aruncă o privire în dexonline)...
==> Migrating HOMEBREW_REPOSITORY (please wait)...
==> Migrated HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Homebrew no longer needs to have ownership of /usr/local. If you wish you can
return /usr/local to its default ownership with:
  sudo chown root:wheel /usr/local
# după cum vezi aveam un brew din epoca primitivă, pe server e altceva
MB:~ eu$ brew --version
Homebrew 1.0.9-67-gce2b11f
Homebrew/homebrew-core (git revision f62e0; last commit 2016-11-06)

Așa mai vii de-acasă!

Hai să vedem ce pachete avem deja instalate cu brew:

MB:~ eu$ brew list
htop    nmap    openssl tree    wget

Firimituri, dar să aflăm mai multe despre un pachet:

MB:~ eu$ brew info tree
tree: stable 1.7.0 (bottled)
Display directories as trees (with optional color/HTML output)
http://mama.indstate.edu/users/ice/tree/
/usr/local/Cellar/tree/1.7.0 (7 files, 113.2K) *
  Poured from bottle on 2015-09-12 at 15:53:39
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/tree.rb

Dar mai bine să le vedem pe cele expirate:

MB:~ eu$ brew outdated
htop (2.0.1_1) < 2.0.2
nmap (7.00, 7.12) < 7.31
openssl (1.0.2e, 1.0.2h_1) < 1.0.2j

UPGRADEAZĂ (versus updatează) tot:

MB:~ eu$ brew upgrade
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
jboss-forge                 postgresql                  sf-pwgen                    wellington

==> Upgrading 3 outdated packages, with result:
htop 2.0.2, nmap 7.31, openssl 1.0.2j
==> Upgrading htop
==> Downloading https://homebrew.bintray.com/bottles/htop-2.0.2.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring htop-2.0.2.el_capitan.bottle.tar.gz
==> Caveats
htop requires root privileges to correctly display all running processes,
so you will need to run `sudo htop`.
You should be certain that you trust any software you grant root privileges.
==> Summary
🍺  /usr/local/Cellar/htop/2.0.2: 10 files, 183.7K
==> Upgrading nmap
==> Installing dependencies for nmap: openssl
==> Installing nmap dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2j.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring openssl-1.0.2j.el_capitan.bottle.tar.gz
==> Using the sandbox
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

This formula is keg-only, which means it was not symlinked into /usr/local.

Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you will need to add to your 
build variables:
# N.B: mai sus era un apostrof care arunca în aer toată formatarea

    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include

==> Summary
🍺  /usr/local/Cellar/openssl/1.0.2j: 1,695 files, 12M
==> Installing nmap
==> Downloading https://homebrew.bintray.com/bottles/nmap-7.31.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring nmap-7.31.el_capitan.bottle.tar.gz
==> Caveats
Python modules have been installed and Homebrews site-packages is not
in your Python sys.path, so you will not be able to import the modules
this formula installed. If you plan to develop with these modules,
please run:
# N.B: Idem, markdown code excape single quote e pe TO DO List
  mkdir -p /Users/eu/Library/Python/2.7/lib/python/site-packages
  echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/eu/Library/Python/2.7/lib/python/site-packages/homebrew.pth
==> Summary
🍺  /usr/local/Cellar/nmap/7.31: 748 files, 23.9M
EOT

Nota bene: văd că mai nou brew face auto-update înainte de upgrade ceea ce ne va scuti pe viitor de glume pe seama sindromului de tunel carpian.

Happy updates!

Pentru informații, feedback sau înjurături am instalat o rolă de hărtie virtuală mai jos...

:D Glumă, peace! Over and out ...