Weekly News Summary for Admins — 2019-11-22

My new book, “Moving to zsh,” is now available in the Apple Books Store!

If you have been reading this newsletter for a while, you know what this book is about, otherwise you can read all the details in my blog post. This is the first of my books that is not targeted specifically at Mac Admins, but is useful to anyone who use the Terminal on the Mac.

Please, spread the word to friends, co-workers, fellow admins, developers, and power-users who you think would benefit from this book. Thank you all for your support.

If you would rather get the weekly newsletter by email, you can subscribe to the Scripting OS X Weekly Newsletter here!! (Same content, delivered to your Inbox once a week.)

On Scripting OS X

News and Opinion

MacAdmins on Twitter

  • Timo Perfitt: “New MacBook Pro 16” in the house!… ” (Thread)
  • Tech Girl: “It’s weird jamf sells jamf protect and treats patch like their child they’re pretending doesn’t exist. How many #macadmin pay for jamf also need jamjar/autopkgr/Munki to properly patch & notify users?”
  • Victor (groob): “Is there someone at Apple who understands that security updates are not optional and that an enterprise might want to enforce a deadline? Lack of MDM options to make this possible suggests otherwise.” (Thread)
  • Carl Ashley: “Things your postinstall scripts are doing that are 100% bad 100% of the time: cp /tmp/foo.app /Applications/foo.app; chmod 777 /Applications/Foo.app; chown root:admin /Applications/Foo.app” (Thread)

Bugs and Security

Support and HowTos

Scripting and Automation

Apple Support

Updates and Releases

To Watch

To Listen

Support

There are no ads on my webpage or this newsletter. If you are enjoying what you are reading here, please spread the word and recommend it to another Mac Admin!

If you want to support me and this website even further, then consider buying one (or all) of my books. It’s like a subscription fee, but you also get a useful book or two extra!

Install shellcheck binary on macOS (updated)

A few months back I wrote a post on how to compile and build an installer for the shellcheck binary for macOS.

Just a few weeks later, the shellcheck project added a download for a pre-compiled binary for macOS. You can now download the binary with this link:

https://shellcheck.storage.googleapis.com/shellcheck-latest.darwin.x86_64.tar.xz

Ironically, macOS can unarchive xz archives when you double click them in the Finder, but there is no command line tool on macOS to unarchive them. In the previous post, I ran into the same problem, and there you can find instructions on how to install the xz tools on macOS.

Update 2020-03-26: I was unnecessarily complicating this. You can use tar to unarchive this:

tar -xf shellcheck-latest.darwin.x86_64.tar.xz

After downloading and un-archiving, you can manually move the shellcheck binary to a suitable directory. The standard location is /usr/local/bin.

For manual installations, this is it! Much simpler than before. Thank you!

Note: if you want the man page as well, you still need to build it with pandoc from the source.

Build a pkg for managed deployment

If you are a MacAdmin and want to distribute shellcheck with your management system, you will need to build an installer package (pkg).

Instead of copying the binary to /usr/local/bin, place it in a payload folder in a project folder. Then build the pkg with pkgbuild:

% mkdir -p ShellcheckPkg/payload
% cp ~/Downloads/shellcheck-latest/shellcheck ShellcheckPkg/payload
% pkgbuild --root ShellcheckPkg/payload --identifier com.example.shellcheck --version 0.7.0 --install-location /usr/local/bin shellcheck-0.7.0.pkg

Replace the 0.7.0 with the actual version number.

Automated Package creation with autopkg

And because all of this isn’t really that difficult, I built autopkg recipes for Shellcheck You can find them in my recipe repository or with autopkg search shellcheck. Enjoy!

New Book Release Day: Moving to zsh

My new book: “Moving to zsh” is now available on the Apple Books Store!

The book should be useful for anyone who uses macOS Terminal and is wondering what the change of the default shell in Catalina means and how to best handle the transition. The book describes the motivation for Apple (and the user) to “move to zsh” and how to get the most out of the new shell.

It is based on the series of blog posts that I posted from June through August, but reworked and expanded with more detail and more topics. Some of the information from my MacSysAdmin presentation also made it into the book.

The blog series added up to about 11K words, and the book, in its current form, is more than 22K words. Compared to the series, I have added images, movies, clarifications, more examples, and several new sections and appendices.

This books explains:
– why Apple is changing the shell
– implications for infrequent and expert Terminal users
– how to move from bash to zsh
– configuring zsh to be more productive
– moving scripts from bash to zsh

And this will certainly not be the end for “Moving to zsh.” Like my other books, I plan to update and add to it after release as well, keeping it relevant and useful.

This is my first book that is not targeted mainly at MacAdmins. I believe this book will be useful for any Mac user that uses the Terminal frequently: Developers, web admins, scientists, and other power users. Please help spread the news by sharing this post and the book link with friends, co-workers, and across social media. Thank you!

Go get “Moving to zsh” on the Apple Books Store!

Weekly News Summary for Admins — 2019-11-15

Hard to believe, but Apple software updates this week (except for new beta releases). Instead we got a new MacBook Pro! (And yes, it has a new keyboard—I really hope we can put this behind us now…)

Also Jamf Nation User Conference in Minneapolis! Hope everyone had a great time and safe travels home!

Progress update: my new book “Moving to zsh.” has been sent to the proof readers!

If you would rather get the weekly newsletter by email, you can subscribe to the Scripting OS X Weekly Newsletter here!! (Same content, delivered to your Inbox once a week.)

Headlines

On Scripting OS X

News and Opinion

MacAdmins on Twitter

  • Timo Perfitt: “In prep for the MDS 2 release, I created some new videos and postings for the new MDM service in MDS.” (Thread)
  • Patrick Fergus: “If anyone was using a CLI uninstall of an Adobe product, the path to Setup changed, assumedly with CCDA 5”
  • Rosyna Keller: “Some fun new stuff with altool 4.0 (Xcode 11.x) is now available.” (Thread)

Jamfnation User Conference

Bugs and Security

Support and HowTos

Scripting and Automation

Updates and Releases

To Listen

Support

There are no ads on my webpage or this newsletter. If you are enjoying what you are reading here, please spread the word and recommend it to another Mac Admin!

If you want to support me and this website even further, then consider buying one (or all) of my books. It’s like a subscription fee, but you also get a useful book or two extra!

Associative arrays in zsh

This is an excerpt from my book “Moving to zsh” which is available for order on the Apple Books Store.

One of the advantages of zsh over bash 3 is the support of “associative arrays,” a data structure known as hash tables or dictionaries in other languages.

In associative arrays, you can store a piece of data, or value with an identifying ‘key’. For example, the associative array userinfo has multiple values, each identified with a key:

% echo $userinfo[name]
armin
% echo $userinfo[shell]
bash
% echo $userinfo[website]
scriptingosx.com

Note: bash 4 also added associative arrays, but they are implemented slightly differently.

Creating associative arrays

In zsh, before you can use a variable as an associative array, you have to declare it as one with

declare -A userinfo

This will tell the shell that the userinfo variable is an associative array. You can also use typeset -A as an alternative syntax. You can verify the type of the variable:

% echo ${(t)userinfo}
association

You can then set the key-value pairs of the userinfo associative array individually:

userinfo[name]="armin"
userinfo[shell]=bash
userinfo[website]="scriptingosx.com"

When you set the value for an existing key again, it will overwrite the existing value:

% echo $userinfo[shell]
bash
% userinfo[shell]=zsh
% echo $userinfo[shell]
zsh

Setting the values for each key is useful in some situations, but can be tedious. You can also set the entire associative array at once. There are two syntaxes for this in zsh:

userinfo=( name armin shell zsh website scriptingosx.com )

This format follows the format ( key1 value1 key2 value2 ...). The other syntax is more verbose and expressive:

userinfo=( [name]=armin [shell]=zsh [website]="scriptingosx.com" )

When you set the associative array variable this way, you are overwriting the entire array. For example, if you set the userinfo for ‘armin’ like above and then set it later like this, the website key and value pair will have been overwritten as well:

% userinfo=( [name]=beth [shell]=zsh )
% if [[ -z $userinfo[website] ]]; then echo no value; fi
no value

If you want to partially overwrite an existing associative array, while leaving the other key/value pairs intact, you can use the += operator:

% userinfo+=( [shell]=fish [website]=fishshell.com )
% echo $userinfo[name]                                           
beth
% echo $userinfo[shell]
fish
% echo $userinfo[website]
fishshell.com

To clear an associative array, you can use:

% userinfo=( )

Retrieving data from an associative array

We have already seen you can get the value for a given key with the ‘subscript’ notation:

% echo $userinfo[name]                                           
beth

When you access the $userinfo variable directly, you will get a normal array of the value:

% echo $userinfo
beth fish fishshell.com

You can also get an array of the keys with this syntax:

% echo ${(k)userinfo}
name shell website

or a list of both keys and values:

% echo ${(kv)userinfo} 
website fishshell.com shell fish name beth

You can use this to copy the data from one associative array to another:

% declare -A otherinfo
% otherinfo=( ${(kv)userinfo )
% echo $otherinfo[name]
beth

You can also use this to loop through all the keys and values of an associated array:

for key value in ${(kv)userinfo}; do
    echo "$key -> $value"
done

#output
website -> fishshell.com
shell -> fish
name -> beth

Limitations

Associative arrays have their uses, but are not as powerful as dictionaries in more powerful languages. In zsh, you cannot nest associative arrays in normal arrays, which limits their use for complex data structures.

There is also no functionality to transfer certain file formats, like XML or property lists directly in to associative arrays or back.

Shell scripting was never designed for complex data structures. When you encounter these limitations, you should move “up” to a higher level language, such as Python or Swift.

Weekly News Summary for Admins — 2019-11-08

Another week, … yes, really… another update. iOS 13.2.2 dropped last night. At this rate, I am surprised there is no Catalina 10.15.1 Supplemental update yet. Maybe next week. We did also get new betas for all the next updates.

In other news, Adobe is finally shipping Photoshop for iPad, and announced Lightroom and Illustrator for the future. I will leave the discussion if this is really a “full” Photoshop or not to others. But I will point out, that this is yet another “Pro” application that is now available on iPad. There are still plenty of reasons or excuses to have a Mac over an iPad, but they are dwindling.

Progress update: I got a lot of work done on my new book “Moving to zsh.” I had set the delivery date to Dec 31, because the Books Store interface required me to enter a date, but I am quite confident now that I will beat that.

If you would rather get the weekly newsletter by email, you can subscribe to the Scripting OS X Weekly Newsletter here!! (Same content, delivered to your Inbox once a week.)

#! On Scripting OS X

📰News and Opinion

🐦On Twitter

  • Rene Ritchie: “I’d love both word count and a plain text option in Notes .app.… ”
  • Bryson Tyrrell: “I think I’ve been vastly under-calculating the amount of traffic that Community Patch serves.” (Thread)
  • Arnold: “Xcode, all you ever tell me is WARNINGS and ERRORS, it’s always problems and bad things with you, that’s so toxic would it kill you to say nice things about my code every once in a while?…” (Great Mockups)

🐞Bugs and Security

🔨Support and HowTos

🤖Scripting and Automation

🍏Apple Support

♻️Updates and Releases

🎧To Listen

📚 Support

There are no ads on my webpage or this newsletter. If you are enjoying what you are reading here, please spread the word and recommend it to another Mac Admin!

If you want to support me and this website even further, then consider buying one (or all) of my books. It’s like a subscription fee, but you also get a useful book or two extra!

desktoppr v0.2 – Notarized

I have just pushed an update to my desktoppr tool which can change the desktop on macOS. No new features but the installer pkg is now notarized.

And because you need to use a newer Xcode and Swift 5 to notarize the tool, it now requires the Swift 5 Runtime support for command line tools when you install it on versions of macOS older than 10.14.4. (On those older versions, you can also continue to use desktoppr-0.1)

Book update: macOS Installation v5

There is a new update to my book “macOS Installation!”

It contains lots of updates regarding Catalina, and the usual list of typos and other fixes.

As usual, the update is free when you already own the book.

If you have already purchased the book, you can go to Apple Books application on your Mac and choose ‘Check for available Downloads…’ from the ‘Store’ menu. I have seen the Mac Books app be really slow (or even completely blind) in picking up updates, you can accelerate the process by removing the local download and re-downloading the book. In iOS tap on your iCloud account icon next to ‘Reading Now’ and then choose ‘Updates.’

If you have not yet purchased the book, I have good news for you: I have lowered the price!

Why did I lower the price? Let me explain…

This is the fourth update for “macOS Installation.” It might be its last.

When I first published the book in June 2018, I promised updates until the Mojave release. There have now been two updates beyond that: one for the Mojave “Spring” update, and another one for Catalina.

The format of the book had the original intention to help MacAdmins learn about and deal with the strange, new post-imaging world that came with the High Sierra and T2 Security chip. I like to believe it did that quite well. But since then, the releases of Mojave and Catalina have added more layers of complexity and information on top of that.

The post-imaging world isn’t new anymore. It is still strange, complicated, and sometimes hard to navigate. However, I feel that the book’s format would have to change to keep being a useful guide. Obviously, such a re-structuring is a massive effort and would pretty much result in a new book. Maintaining and updating a book is a lot of effort, re-writing it even more so.

Thus the decision that this might be last update for “macOS Installation.” Depending on how disruptive the changes in the Catalina “spring” update will be, I might update for those, but I am not planning to update the book for 10.16 next year.

I might work on some new book on macOS deployment and management in the future. However, I have a few other topics I want to publish before I do that, so that might be a while.

Charles Edge’s and Rich Trouton’s new book should be a great successor to “macOS Installation”:

  • Rich Trouton’s and Charles Edge’s “Apple Device Management: A Unified Theory of Managing Macs, iPads, iPhones, and AppleTVs”: pre-order on Amazon US, UK, DE (Affiliate Links)

“macOS Installation” should remain useful for the life time of Catalina, which, depending on your deployment practices should be another one to four years, more if 10.16 and 10.17 do not drastically change everything again.

Readers who bought the book 16 months ago got several updates for free. I believe free updates are one of the great value propositions of self-published digital books. Most computer related information changes quickly these days and being able to update digital books is a great way to extend their lifetime, usefulness, and value.

My plan to not further update for “macOS Installation” thus lowers its value a bit, and to reflect that I am lowering its price in the store.

That said, I am convinced the book is still very helpful and full of useful information as it is, so if you have not bought the book yet, this is your chance!

Changes in this version (you can also find this in the book in the ‘Version History’ section):

  • added “Moving to zsh” to More Books and updated links to new Apple Books format
  • extended the explanation on FileVault and the Secure Token
  • added Catalina System Volume Layout description
  • added instructions to block the macOS Catalina download
  • added an explanation for the expiring installer certificates from October 2019
  • updated download links for Older macOS Versions
  • added notes to NetBoot-based Installation regarding its further demise and the removal of System Image Utility from Catalina
  • added information on new softwareupdate features in Catalina to macOS Installer Application
  • added a section on new Catalina features
  • added a description of new stub Installer application behavior with startosinstall
  • added link to new SecureToken documentation
  • updated text and tables to reflect the 2019 iMacs
  • clarified reboot behavior of Mojave and High Sierra with Custom Packages
  • added a list of MDM commands that require DEP
  • now using the term ‘conventional’ Macs to refer to non-Secure Boot or pre-T2 Macs
  • many typos, minor changes and clarifications

Weekly News Summary for Admins — 2019-11-01

While I got to take off a week for vacation, Apple certainly did not… Welcome back!

We got expiring certificates and lots of updates! Also, new AirPods Pro.

I have tried to put some order into all the links I gathered over the last two weeks. If you think I missed anything, please let me know!

Also, remember that my new book “Moving to zsh” is available to pre-order!

If you would rather get the weekly newsletter by email, you can subscribe to the Scripting OS X Weekly Newsletter here!! (Same content, delivered to your Inbox once a week.)

News and Opinion

MacAdmins on Twitter

  • Adam Codega: “Vendors and others who link to macadmins.org: make sure you’re linking to macadmins.org and not our (now offline) Heroku URL”
  • Erik Gomez: “Catalina brings an undocumented change to MDM profiles. You can no longer mark them as ”removable“. The only way to remove MDM profiles now is by unenrolling from MDM or the MDM sending a removal command. This was never mentioned in WWDC, Developer Notes or AppleSeed.”
  • Peter Steinberger: “There’s a user default setting: NSApplicationCrashOnExceptions to make macOS apps terminate when an exception is thrown – just as things are on iOS. Microsoft has great documentation on that. Apple, not so much.”
  • Mr. Macintosh: “macOS Catalina 10.15.1 Beta 3 is now available. This post was late because I was thinking about stopping my Beta Update posts. Instead, I need to keep showing everyone how embarrassing macOS Patch Notes have become.”
  • Patrick Fergus: “Adobe Shared Device License 2.0, released 10/21/19 – Sign-in only shows needed information, e.g. if only Federated IDs allowed, Facebook not shown – Prompt reminds users to save & sign out of CC – CCDA Apps panel optionally visible & users can install & update”
  • Preshit Deorukhkar: “Massive update to Adobe Creative Cloud on iOS that brings the entire @AdobeFonts / @Typekit Collection to your iPhone or iPad. Dark Mode too.”

Bugs and Security

Expired Package Certificates

Support and HowTos

Scripting and Automation

Apple Support

Apple Updates

Updates and Releases

To Listen

Just for Fun

Support

There are no ads on my webpage or this newsletter. If you are enjoying what you are reading here, please spread the word and recommend it to another Mac Admin!

If you want to support me and this website even further, then consider buying one (or all) of my books. It’s like a subscription fee, but you also get a useful book or two extra!

Weekly News Summary for Admins — 2019-10-18

Another week, another iOS update. And also another macOS Catalina… Supplemental… Update?

As a Mac admin, I am getting envious of iOS system version numbering.

While I grumble about the nomenclature, the “Supplemental Update” fixed the persisting request to log in to iCloud i had on my MacBook, so it is welcome, whatever it is called.

Note: because of travel and vacation, there will be no Newsletter next week, October 25. The newsletter will be back on November 1!

If you would rather get the weekly newsletter by email, you can subscribe to the Scripting OS X Weekly Newsletter here!! (Same content, delivered to your Inbox once a week.)

On Scripting OS X

News and Opinion

MacAdmins on Twitter

  • mikeymikey: “32-bit Intel Macs: Introduced 13 years ago – stopped shipping that same year. Every since has been 64-bit. 10.7 Lion: Launched 8 years ago in 2011 – required 64-bit. macOS had warnings about 32-bit app launches in 10.13 and 10.14. Why was ANY dev shipping 32-bit -only-?” (Thread)
  • Erik Schwiebert: “It took us /years/ to get rid of the Carbon code in Office and make the switch to 64-bit. And we were done in 2016…”
  • John Goering: “A WWDC slide from a more civilized time in Apple’s history.” (Image)
  • Armin Briegel: “System Image Utility is gone from macOS Catalina. It is not possible to build a NetBoot or NetInstall nbi based on Catalina. (You can probably hack one together, this is not meant as a challenge.) No currently sold Mac model is able to NetBoot. NetBoot is dead.”

macOS Catalina

Bugs and Security

Support and HowTos

Scripting and Automation

Apple Support

Updates and Releases

To Listen

Support

There are no ads on my webpage or this newsletter. If you are enjoying what you are reading here, please spread the word and recommend it to another Mac Admin!

If you want to support me and this website even further, then consider buying one (or all) of my books. It’s like a subscription fee, but you also get a useful book or two extra!