Weekly News Summary for Admins — 2023-02-10

Even though Apple still hasn’t released a beta for macOS 13.3 and iOS 16.4, there are several updates for tools from the MacAdmins community, be sure to check out that section.


(Sponsor: Mosyle)

Mosyle Logo

The only Apple Unified Platform for Business

Mosyle is the only solution that fully integrates Enhanced MDM, Endpoint Security, Internet Privacy & Security, Single Sign-On, and Application Management on a single Apple-only platform.

Click here to learn why Mosyle is all you need to work with Apple.


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.)

📸Focus

The MacAdmins Foundation has announced that they can now provide Apple Developer ID signing identities to MacAdmin open source projects.

Open source projects for the Mac usually have the choice between not signing their software releases, or signing them with a personal or organizational Apple Developer ID, which cost a yearly subscription and, in the case of the personal ID, literally puts the name of the main lead in the signature.

The MacAdmins Foundation certificates now provide another option, that will be very attractive for some projects. Nudge is the first tool that has been released with a MacAdmins Foundation signature.

📰News and Opinion

⚙️Software Updates

🦣Social Media

  • Kristian Harstad: “You don’t need a photo background removal app if you run MacOS. Right-click a photo in Finder, click Quick Actions, choose Remove Background. Your Mac does the rest perfectly, and produces a background-removed copy of your photo with “Background Removed” suffixed to the filename.”

🔐Security and Privacy

🔨Support and HowTos

🤖Scripting and Automation

♻️Updates and Releases

📺To Watch

🎧To Listen

📚Support

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 — 2023-02-03

How is it February already? Didn’t we just do New Year’s and that January thing?


(Sponsor: SentinelOne)

macOS Payloads: 7 Prevalent and Emerging Obfuscation Techniquese

Learn about the techniques behind the latest macOS threats and stay ahead of the game in protecting your enterprise. From hidden scripts and shell script compilers to obfuscated Python, Cobalt Strike and more.

Continue Reading Here >>


A week has passed since the release of macOS 13.2 and iOS 16.3 and no beta for 13.3 and 16.4 yet. I don’t think we should read too much into this, but it is unusual.

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.)

Focus

Congratulations to all who got (or will get) the scholarship certifications and many thanks to the Mac Admins Foundation for making this possible!

The Penn State MacAdmins conference announced the date this week. Also, JNUC opened their registration. If you are planning to present at conferences, now is the time to start making plans. You can find a list of the conferences so far along with links to their information, registration, and ‘call for sessions’ pages on my conference page.

After three years of mostly virtual presentations, fun as they were, I have to remember that participating on-site in four or more conferences is probably not a wise choice…

News and Opinion

Social Media

  • Kris Nóva: “So we (GitHub) just rolled out support for Mastodon profiles.”

Security and Privacy

Support and HowTos

Scripting and Automation

Updates and Releases

To Listen

Just for Fun

Support

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 — 2023-01-20

Not only did we get release candidates for the iOS 16.3 and macOS 13.2 updates next week, but Apple also released new MacBooks Pro and a new Mac mini with M2 and M2 Pro and Max chips. Also, they released a second generation big HomePod.


(Sponsor: SentinelOne)

Top 10 macOS Malware Discoveries in 2022

How did threat actors change their TTPs in 2022? What new trends did we observe? Improve your defenses by understanding the most recent macOS malware families.

Continue Reading Here >>


The Mac mini with the M2 Pro chip closes an annoying gap that Apple has had in their Mac portfolio. In the Intel Mac era, the use case for a powerful desktop Mac was covered by the high-end iMac and Mac mini, as well as the low-end Mac Pro. With M1 chips the Mac mini and iMac with M1 maxed out at 16Gb of RAM. The Mac Studio starts with the M1 Max chip at a higher price point. The Intel Mac mini sort had to fill that particular gap.

But the new Mac mini with the M2 Pro Chip nicely fills this slot, where is provides more CPU, GPU, RAM, and SSD than the ‘plain’ M1/M2 while staying below the Mac Studio’s price range.

I can see many uses for this “Mac mini Pro” especially for users who prefer the size, battery life, and price point of the MacBook Air over the more powerful 14″ and 16″ MacBooks Pro, but may want just that more power on their desktop connected to a multi-display setup. Also, lightweight video and audio editing stations that may have been limited by the ‘plain’ M1’s RAM limitation, should be fine with the Mac mini with the M2 Pro. One of the amazing aspects of the Mac mini is that its particular design has been nearly unchanged since 2010.

With the introduction of the Mac mini with the M2 Pro chip, Apple has also removed this second-to-last remaining Intel Mac, the 2018 space gray Mac mini with a 6-core Intel core i5 chip, from the store. The 2019 Mac Pro is now the last remaining Intel Mac.

There are still some weird empty spots left in the product line up. The iMac 24″ still has the ‘plain’ M1, and the ‘M2 or M2 Pro’ options would fit the iMac line nicely, too. Many are hoping for a larger iMac display option, but I am not so sure this is in Apple’s plans (I’d love to be wrong). The option to connect a second, external display on a potential ‘iMac with M2 Pro,’ could be a workable alternative, leaving the high-end, multi-screen setups to the Mac Studio and Mac Pro.

The other empty spots in the Mac line-up are at the extreme ends. The Apple silicon Mac Pro will be a challenge and come under intense scrutiny from the Pro users that need that level of power and expandability and those that claim to. A new, smaller MacBook in the style of the 12″ MacBook, or 11″ MacBook Air, which gives up some processing power in favor of size, portability, battery life and (maybe) price, would be quite interesting. I’d also like Apple to take a stab at a ‘Mac nano’ closer in size to the Apple TV, which can be powered over USB-C/Thunderbolt and connected to a display or dock with a single cable.

It is also rare that Apple revives a product after discontinuation, which makes the new 2nd generation HomePod quite intriguing. The original HomePod was never for sale in my region, so I set up two pair of IKEA’s Symfonisk speakers in our house, which work fine. But I wish the Sonos software which powers the Symfonisk speakers would support HomeKit and Shortcuts better, or at all. I also have a single HomePod mini. The options to ‘move’ music (and radio and podcasts) from the phone or Mac to the HomePod are more powerful than on the Sonos software, but the Siri-only interface is still bewildering to me. There is also an interface to control the HomePod in the Home app, but that also seems quite unintuitive. On the other hand, the size of the HomePod mini allows me to take it on travels, which I think is wonderful.

In non-hardware news, the X World conference has announced dates for their conference in Melbourne, Australia on March 30 and 31 making it the next upcoming MacAdmin conference.

As always, you can find an overview on my conference page.

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.)

Focus

I want to take this as chance to explain my treatment of Twitter going forward for now:

I have always used third-party Twitter clients (mostly Tweetbot) over the web interface or their native app. I have always found the web interface confusing, grating, and just too much attention-seeking. I had stopped interacting on Twitter after the takeover and only used it to catch up with some accounts which I have not found to be elsewhere.

I was expecting the worst for Twitter after the takeover, but even so, the utter lack of respect, decency, and humanity shown to employees, advertisers, users/creators, and now third-party developers has been shocking.

I understand that Twitter as a business was probably in for some tough times either way. But economic pressure is no excuse for this crass, and cowardly behavior. You should not assume malice where incompetence is an explanation. In this case, though, it just might be both.

I have stopped reading Twitter entirely. I am in the process of removing Twitter references from my pages. (Though I might not have found every reference yet.) Weblog entries will still automatically post to Twitter, but I will not engage there any more, at all.

It used to be that Twitter would provide a majority of the traffic going to my weblog, second only to search engines. This started to change earlier last year with a significant drop in November, which continues to this day. Other social media such as the Mastodon Fediverse and LinkedIn seem to making up for that drop and I am active and engaged there, as well as the MacAdmins Slack.

News and Opinion

Social Media

Security and Privacy

Support and HowTos

Scripting and Automation

Updates and Releases

To Listen

Support

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 — 2022-12-16

The holidays are near, the year is approaching its end. But for MacAdmins, this remained a busy week. The first update for macOS Ventura was released alongside iOS and iPadOS 16.2 many other updates.


(Sponsor: iMazing)

Your favorite tool for configuring & provisioning fleets of Apple mobile devices

Automatically back up devices, restore, wipe, set up, supervise, and enroll with your MDM provider—locally and easily with iMazing Configurator.

And don’t miss iMazing Profile Editor, our free and well-loved utility for composing comprehensive configuration profiles for iPhones, iPads, and Macs.


This is the first macOS update after the “special measures” to avoid a bug in the macOS software update system present in 12.3 though 12.6 that would consider upgrades to 13.x as updates with regard to managed deferrals. Now, Monterey client in that version range will present 13.1 to the end user, even if major updates are managed to be deferred. Apple has updated the support article on this.

The new updates bring some new features, as well. The new Freeform app seems like a nice tool. I have actually used Keynote for similar tasks, but I think Freeform is a bit, well, free-er and creative. We also got the new Advanced Data Security for iCloud, network locations make a return to macOS Ventura, and “Apple Music Sing”…

This is the last news summary for the year 2022. Many thanks to all of you readers!

Happy Holidays and all the best for the new year 2023!

The news summary will return on 13 January 2023. See you then!

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

macOS Ventura 13.1 and iOS 16.2

macOS Ventura 13.1

iOS 16.2 and iPadOS 16.2

Apple Platform Deployment Guide

Other Systems

Applications

Apple Support

Community

Social Media

  • @mikeymikey@hachyderm.io: “JUST A REMINDER: 13.1 is the first Ventura update past the 30 day hold for OTA major upgrades for MDM managed macOS devices. If you have devices on 12.3-12.6 still and you DO NOT have a minor deferral in addition to a major deferral – on these buggy versions of macOS (12.6.1+ fixes the bug), 13.1 OTA will be seen as a -minor- update, not major and as such will NOT be deferred by only having a major deferral in place.” (Thread)
  • @scriptingosx@mastodon.social: “Apple’s new Freeform app seems nice. I can see myself using this. However, there are no Shortcuts actions and no AppleScript dictionary. (I know… what was I expecting…) I can think of several workflows where Freeform would fit in wonderfully. Now imagine you could add buttons with shortcuts or Apple scripts in Freeform!”

Security and Privacy

🔨Support and HowTos

Scripting and Automation

Updates and Releases

To Listen

Support

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 — 2022-12-02

We got another round of betas for macOS Ventura 13.1 and iOS/iPadOS 16.2. If the schedule from previous years can be taken as guidance, next week is a good guess for the release date. Maybe a week more, since this week’s release was not labeled as release candidate.


(Sponsor: iMazing)

Your favorite tool for configuring & provisioning fleets of Apple mobile devices

Automatically back up devices, restore, wipe, set up, supervise, and enroll with your MDM provider—locally and easily with iMazing Configurator.

And don’t miss iMazing Profile Editor, our free and well-loved utility for composing comprehensive configuration profiles for iPhones, iPads, and Macs.


Jamf has released the session recordings from the Jamf Nation User Conference earlier this year on YouTube, accessible to all! There are 151 videos, many of which should be interesting, even when you don’t use Jamf as your management server. I have updated the resources page for my session, as well as my conferences overview page.

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

macOS Ventura and iOS 16

macOS and iOS Updates

Social Media

  • SentinelOne on Twitter: “10 wrong assumptions about #macOS #security A thread”
  • Basic Apple Guy on Twitter: “iCloud Storage Over the Years” (Image)
  • MartinLang on Twitter: “The SAPTechEd 2022 keynotes had lots of ‘Mobile Moments’ in them. Native Mobile apps are definitely a thing across SAP’s entire Solution and Tech portfolio. I wanted to share some of these mobile moments in this thread.”
  • Mr. Macintosh on Twitter: “Apple uses the terms ‘Shipping OS’ or ‘version of macOS that came with your Mac’ Purchased: M1 16″ MBP on 10/18/21 = Monterey 12.0.1 M1 16″ MBP on 11/30/22 = Ventura 13.0 The 16″ was shipped with Ventura, but it can still be downgraded to 12.0.1 My Apple Silicon macOS chart” (click for chart and short thread)

Security and Privacy

Support and HowTos

Scripting and Automation

Apple Support

Updates and Releases

To Watch

To Listen

Just for Fun

Support

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 — 2022-11-11

The first Apple Silicon Macs with the M1 chip were introduced two years ago. The MacBook Air, MacBook Pro 13″ and Mac mini all kept the same enclosure designs as their Intel-based predecessors, but the chips inside were the largest change for the Mac platform since the Intel transition in 2006.


(Sponsor: Mosyle)

Mosyle Logo

The only Apple Unified Platform for Business

Mosyle is the only solution that fully integrates Enhanced MDM, Endpoint Security, Internet Privacy & Security, Single Sign-On, and Application Management on a single Apple-only platform.

Click here to learn why Mosyle is all you need to work with Apple.


If you think your company or product is a good fit to sponsor this newsletter, please contact me!

At the JNUC conference earlier this year, I noticed that there were no chains of powerstrips running through the audience areas of the presentation rooms. You couldn’t charge your laptop or tablet in the sessions and nobody seemed to be bothered by this. Just this week I ran my MacBook Air M2 and my iPad Air on battery for two days before I bothered looking for my power supply. I still had enough power to run them for the rest of day, which was a good thing, since I realized I still had the US power plug from aforementioned trip to JNUC on my power supply.

Even though they seem to merely sip power, the new chips aren’t slouches either. Apple has had an exceptional position in power/performance ratio in the phone and tablet space, and now, unsurprisingly, Apple laptops are in this position, as well.

For desktop computers, where power use is not quite such a priority, the M1 Max and Ultra configurations provide astounding capability. The only Mac line that has not yet transitioned to Apple Silicon is the Mac Pro. Given the connectivity and expandability of the Mac Pro, it is not suprising this is the last model to transition. The Mac Studio hints at what might be possible, but we will have to wait and see. I could be ungenerous and point out that Apple missed their self-imposed two-year time line of transistioning to Apple Silicon, but honestly, with all the supply chain challenges and other world events that happened since then, it is an amazing achievement to be where they are now.

Apple Silicon is one of the reasons Apple has been the only computer vendor to show growth in the last quarter.

Another amazing aspect of the transition is how smooth it was on the software side. macOS ran without issues from the days of the Developer Kit. This was Apple’s third processor transition in as many decades and you could tell. Rosetta on Apple silicon provides amazing performance for the software that hasn’t been compiled for Apple silicon yet and it is fairly straightforward for vendors and developers to provide native and unverisal binaries. Even though some developers, especially those building electron-based apps, still don’t seem to understand the concept of universal apps.

Apple now has reached their goal of controlling the entire package, or at least the most important parts. They design and build the hardware, the interfaces, the silicon, the software, and many of the services that connect the device to the net and to other devices.

PowerPC was the core for Macs for 12 years. Intel chips lasted for 14 years. I am looking forward to what happens in the next 12-15 years.

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

macOS and iOS Updates

Support and HowTos

Scripting and Automation

Updates and Releases

To Watch

To Listen

Support

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 — 2022-10-28

Release week! If this were a printed newsletter, it would be quite heavy: lots of links and posts, both from Apple and the MacAdmin community.


(Sponsor: Mosyle)

Mosyle Logo

The only Apple Unified Platform for Business

Mosyle is the only solution that fully integrates Enhanced MDM, Endpoint Security, Internet Privacy & Security, Single Sign-On, and Application Management on a single Apple-only platform.

Click here to learn why Mosyle is all you need to work with Apple.


If you think your company or product is a good fit to sponsor this newsletter, please contact me!

I think it is fair to say that the Ventura beta and release has some challenges for system administrators. On the other hand, the updated Apple Platform Deployment guide and several support articles were ready on day one with lots of great information.

Many MacAdmins were awaiting the release and the end of the NDA and ready with several posts on topics they learned about during the beta. The most posts were on the new “Login and Background Items management” but several other posts on other new features and issues, as well. As always, thanks to everyone who shares their knowledge!

Aside from the major releases for macOS Ventura 13.0 and iPadOS 16.1, we also got iOS 16.1, watchOS 9.1, updates for tvOS, HomePod, the apps formerly known as iWork (Numbers, Keynote, and Pages), a new Xcode 14.1 RC, updates for Apple Business Essentials, Safari, macOS Monterey 12.6.1, Big Sur 11.7.1, and iPadOS and iOS 15.7.1. Also, the next round of updates for all the platforms is available in beta on AppleSeed for IT and for Developers, and we got a beta for the iCloud web interface.

Much to catch up on. I hope this collection of links and posts will help.

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

macOS Ventura and iOS 16

macOS Ventura 13.0

iPadOS and iOS 16.1

watchOS 9.1

tvOS 16.1

HomePod Software

Services

Applications

User Guides

Apple Support

Reviews

Reactions and Posts

Login Items in Ventura

macOS and iOS Updates

Social Media

  • Mischa vd Bent: “Did you know about this nice feature with GitHub? Visual Studio Code is build into their website.”
  • John C. Welch: “One nice thing about MS (unlike Apple) having such detailed documentation about the powershell/VBA scripting implementation for Office, is that same model is the source for the AppleScript implementation, so you can use the PS/VBA docs to help you with AppleScript.”
  • Rosyna Keller: “In tons of places in macOS, including in Xcode’s log when notarization fails, there’s typically a “?” button in dialogs that if you click it, will bring you either to local or online documentation. In the notarization case, these buttons will take you to specific online docs.”

Security and Privacy

Support and HowTos

Scripting and Automation

Updates and Releases

To Listen

Support

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 — 2022-10-14

Apple’s macOS Ventura Preview page still states “Coming this October.” The rumors, past experience and practicality point to October 24 as the release date for macOS Ventura 13.0 as well as iPadOS 16.1 and the first round of updates for iOS 16, watchOS 9 and all the others.


(Sponsor: vast limits)

uberAgent Logo

uberAgent: per-application network monitoring

uberAgent is an innovative user experience monitoring product for macOS and Windows. uberAgent’s highlights include detailed information about application performance, network reliability drill-downs, application usage metering, browser performance, and web app metrics. Try for yourself and get your free 100 user community license at uberagent.com.


If you think your company or product is a good fit to sponsor this newsletter, please contact me!

On the other hand, Stage Manager still seems to be quite a mess in both iPadOS and macOS. Also, there was no announcement for an Apple Event on October 18, which you would expect if Apple wanted to announce new iPads Pro and/or a new Mac Pro to go with the iPadOS and macOS releases. Apple could very well release new hardware after the system releases, but it would be unusual.

The Mac Pro is the last Mac which has not transitioned to Apple Silicon yet and the two-year transition timeline, ,promised at WWDC 2020 with the Apple Silicon reveal expires in November, two years after the first M1 MacBooks shipped. The Mac mini, which is currently available as M1 and Intel models, also seems due for an upgrade.

We did get a new round of betas this week, which brings macOS 13 to beta 11. As a MacAdmin, you really should log in to AppleSeed for IT and read the beta notes that Apple makes available there, regarding software update deferral.

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

macOS Ventura and iOS 16

macOS and iOS Updates

Social Media

  • William Smith: “As of Tuesday this week, version 16.66 of Microsoft Office for Mac was released and will be the last version to support macOS Catalina 10.15.”

Security and Privacy

Support and HowTos

Scripting and Automation

Updates and Releases

To Listen

Support

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 — 2022-09-30

For me, this week was fully dominated by JamfNation User Conference (JNUC). It has been amazing and quite overwhelming to meet with all of you enthusiastic, smart, and inspiring Mac Admins!


(Sponsor: vast limits)

uberAgent Logo

uberAgent: application usage monitoring

uberAgent is an innovative user experience monitoring product for macOS and Windows. uberAgent’s highlights include detailed information about application performance, network reliability drill-downs, application usage metering, browser performance, and web app metrics. Try for yourself and get your free 100 user community license at uberagent.com.


Jamf has been posting summaries of some sessions on the Jamf Blog. The sessions will be available for registered users (both virtual and in-person) in the conference portal for the next 60 days and then released for everybody on Jamf’s YouTube channel. I have a lot of catching up, and also a lot of re-viewing to do.

To everyone who took the time to talk with me, a huge thank you. All the kind feedback is both humbling and inspiring. To all who I missed or whom I couldn’t spend enough time with, because there was always the next engagement or meeting to run off to: I am terribly sorry! I hope we get a chance to talk at the next conference!

JNUC 2023 was announced for September 19–21 in Austin, Texas, USA.

(This news summary is unusually scheduled because of travel and time zones. I might also have missed some interesting links and posts. If you found something that I didn’t include, please let me know and I will include it next week.)

But the conference fun is not over: next week is MacSysAdmin Online and the speaker list was just released!

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

macOS Ventura and iOS 16

Security and Privacy

Support and HowTos

Scripting and Automation

Apple Support

Updates and Releases

To Listen

Support

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!

Launching Scripts #1: From Terminal

Scripts, no matter which language they are written in, are an incredibly important part of a MacAdmin’s tool kit.

Most posts, books and tutorials focus on how to write scripts. Admittedly, the skill to make the computer and all its software running do what you want is very important. But once you have a working script, you will have to consider how to launch the script at the right time and with the right input.

When I started to think about this, I realized macOS provides many ways to launch or schedule scripts. Some are fairly obvious, others are quite obscure and maybe even frivolous.

Over the next few weeks (i.e. when I find time), I will publish a series of posts describing various ways of launching scripts and workflows on macOS. This post starts with the most obvious: launch a script from Terminal.

The Basics: Launch from Terminal

It might seem trivially obvious that you can launch scripts and workflows from Terminal. Nevertheless, it does require some explanation and context. Launching from Terminal is the most basic form of launching a script. As such, it defines the ‘baseline’ experience of how we expect scripts to run.

Command lookup

When you enter something into a Terminal prompt and hit the return key, the shell will split the text on whitespace. The first element of the text is the command. If that text contains a / character, the shell will interpret the entire element as a path to the executable. The path can be relative or absolute.

If the first element does not contain a / then the shell will first look for functions, aliases and built-in commands, in that order. Then the shell will search for a command executable using the colon-separated paths in the PATH environment variable. It will use the first executable it finds.

If the shell fails to find something to execute, it will show an error.

This is why you need to the ./ to execute scripts in the current working directory. Even though the ./ seems redundant, it tells the shell to look for the executable in the current working directory, instead of using the PATH.

You can find this process described in more detail here. I also have a post on how to configure your PATH variable.

Shebang

Scripts are ‘just’ text files. Two things distinguish them from normal text files.

First, the executable bit is set to tell the system this file contains executable code. You do this with the chmod +x my_script.sh command. Here comes the trick, though. The text in the script file isn’t really executable code that the CPU can understand directly. It needs an ‘interpreter’ which is another program that, wells, interprets the text file and can tell the CPU what to do.

The interpreter for a script file is set in the first line of the script with the #! character combination. The #! is also called ‘hashbang’ or ‘shebang.’ The shebang is followed by an absolute path to the interpreter, e.g. /bin/sh, /bin/bash, or /usr/local/bin/python.

Note: the shebang has to be in the very first line (actually the first characters) of the script, you cannot have comments (or anything else) before it.

Note: you often see shebangs using the env command in the form #!/usr/bin/env bash. These are useful for cross-platform portability, but have trade-offs. I have an article just for that.

Arguments

The shell is only interested in the first part of the command line text you entered. The entire list of parts (or elements, split on whitespace) are passed into the command as its arguments. A shell script sees the first element, the command or path to the command as $0 and the the remaining arguments as $1, $2, and so on.

Other languages will handle this in a similar fashion, arrays or lists of arguments are common.

Environment

Shells also have environment variables. We already talked about the role of the PATH variable in the command lookup. In Terminal, you can list all variables in your current environment with the env command. Some of these environment variables can be extremely useful, like SHELL, USER, and HOME.

When you launch a script from Terminal, a new shell environment is created and all of the environment variables are copied. This is great, beacuse the script can access the environment variables, and might even change them. But the changes in the script’s sub-shell, will not affect the current shell. In other words, a script can change the PATH environment variable in its own context, without changing yours.

In other Unix-based systems, environment variables are a common means of providing data to apps and processes. In the interactive shell on macOS, environment variables are very useful for this purpose. We will see, however, that when you launch processes and scripts through other means, environment variables can be a challenge on macOS.

Note: A shell environment also contains shell options, which are also inherited to sub shells.

Input and Output

Shell scripts and tools also have input and output. When you launch a script from the the Terminal, both output streams (Standard Output and Standard Error) are connected to the Terminal, so the output will be shown in the Terminal window.

When you use a script with pipes, then its Standard Input (stdin) will be connected to the previous tool’s Standard Out (stdout). The last script’s stdout and stderr will be shown in Terminal.

One thing that is special about interactive Terminal input and output, is that it happens while the script or tool is running. That means you can get live updates on the progress.

When we launch scripts in other contexts, their input and output may be buffered. This means that the system waits for the script or tool process to complete before piping its output to the next tool or to the process that called it. This is not something you usually have to worry about, but again it is something you should have in mind when running scripts in non-Terminal contexts.

Conclusion

While glaringly obvious, launching a script from Terminal does have some intricacies. This post sets a ‘baseline’ for how scripts work on macOS. In future installments, we will re-visit some of these topics, and the differences will become relevant when we launch scripts in contexts other than an interactive shell.

In the next post, learn how to create a double-clickable file to launch a script from Finder.