Questions tagged [script]

A collection of commands that may be from a CLI Shell, or programming language such as AppleScript, which are executed in order with limited iteration, usually as a way of automating actions or events.

Filter by
Sorted by
Tagged with
1 vote
1 answer
17 views

need to turn separate zsh script into a function inside a master script

I'm trying to turn 6 scripts into one script, so that instead of the enduser needing to download 6 scripts, do chmod +x mess to them etc, and then run the master script, they'd only need one script ...
user avatar
  • 1,090
0 votes
0 answers
17 views

Admin account sudo code asking for password in Applescript

I'm trying to create an Applescript that COMPLETELY removes the user from having to set up an admin account AND with full access to the disk (on macbooks/macbook pros). The newly created admin account ...
user avatar
0 votes
1 answer
51 views

Shell command no longer working

I'm on a M1 MacBook Pro running macOS 12.3.1. I've had some AppleScripts that perform a shell script run happily for many years. For some unknown reason these have just stopped working today - nothing ...
user avatar
0 votes
0 answers
42 views

Installer is getting failed while running post install script

The installer is getting failed while running the post-install script with error: *** Couldn't posix_spawn: error 2 We are importing the certificate in the post-install script for validation. ...
user avatar
0 votes
0 answers
24 views

Need to automate changes to my Display settings

As a former engineer, I know that if I find myself doing the same thing over and over, I should be able to automate that process. So here goes: Due to things beyond my control, every time I log into ...
user avatar
0 votes
0 answers
46 views

Shell Script to check password has been set to Immediately and what the screen saver time is set to

I need to create a script for checking a security posture of a machine using OPSWAT MetaAccess. They have a built-in check, however, according to them, they aren't able to check since macOS 10.13+. ...
user avatar
1 vote
1 answer
23 views

How to remotely & automatically switch a Mac's audio output device

I have a Mac (running Catalina) dedicated as a media server, running Plex and Spotify. I'd like to be able, from my Mac laptop, to simply click something and switch the remote Mac's audio output ...
user avatar
  • 1,060
0 votes
0 answers
31 views

Run script upon Xcode project creation?

Is there a way to run a shell script upon creating an Xcode project? I plan to do this so that I can store the project in OneDrive, but use the shell script to make an alias in iCloud Drive. Is there ...
user avatar
  • 11
0 votes
0 answers
14 views

MacOS Monterrey will not run shell scripts [duplicate]

I use shell scripts a lot. Ever since upgrading to OS Monterrey 12.3.1, none of my shell scripts will run. They are in the same locations they were before the upgrade to Monterrey. I execute a shell ...
user avatar
1 vote
1 answer
174 views

Cannot run shell scripts on OS Monterrey (12.3.1) after update from Big Sur (11.4)

I use shell scripts a lot. Ever since upgrading to OS Monterrey 12.3.1, none of my shell scripts will run. They are in the same locations they were before the upgrade to Monterrey. I execute a shell ...
user avatar
0 votes
2 answers
123 views

Setting up env command for bash scripts

I am using Big Sur for work. I want to write a bash script that uses some modern bash features. The bash that comes with Big Sur is fairly old: $ /bin/bash --version GNU bash, version 3.2.57(1)-...
user avatar
0 votes
3 answers
301 views

zsh: command not found

I created a script , tried putting it in ~/.local/bin/script.sh and /usr/local/bin/script.sh but I get zsh: command not found: script This is my .zshrc file: cat .zshrc # If you come from bash you ...
user avatar
0 votes
0 answers
31 views

How to choose multiple folders and open them AppleScript

I made a script to open a folder on an online volume and I wanted it to ask how can I choose multiple folders while the prompt is open and then open them all. Every time I do that I get this error: ...
user avatar
0 votes
2 answers
67 views

Importing Safari reading list to Pocket

I'd like to pull (long) my safari reading list into Pocket. Searching StackExchange/Google suggests the script here (also pasted below), but when I run it, it says line 19: syntax error: unexpected ...
user avatar
  • 11
0 votes
1 answer
40 views

How can I trigger a mac daemon on an event other than scheduling a time interval?

I have made a few Mac daemons in the past. They either run at launch or run at a specific time interval, for example, once every hour. I would like to know if it's possible to run a program on an ...
user avatar
0 votes
2 answers
75 views

Help with simple Automator script

Id like to be able to select files(s) from the desktop and be able to choose from the quick menu which sub-folder to move them to. I have this now But it only gets me Modeling and I want the ability ...
user avatar
  • 577
0 votes
0 answers
9 views

Message a number using Services - Automator

When I highlight a number and right-click on it, I want to be able to access the Messages app to text that specific number. I have tried many different ways but none has worked. Not sure what ...
user avatar
0 votes
0 answers
22 views

Startup Script to make Mac sleep at lock screen

Recently I wrote a simple script to run when my MacBook starts up to set the battery charge limit for the day and then reset. Because the laptop is docked every day except two days per week, I want to ...
user avatar
9 votes
2 answers
743 views

Updating just Safari through terminal on Big Sur

There is a new version of Safari and I'm trying to update just Safari on my machine using a terminal command. I have Big Sur 11.6.3. I've done Softwareupdate -l and I see the Safari update there. I ...
user avatar
  • 171
0 votes
1 answer
41 views

Defined bash commands not found when passed in "do shell script" in osascript

I am new to shell script and recently wrote a script to open a new terminal window and run defined functions via osascript with "do shell script", but the result showed the command not found....
user avatar
0 votes
0 answers
17 views

Apple Script if input has specific word in it delete it and everything followed by that word

In this question here I thought that my automator script isn't working on different macs. That wasn't the case. The real reason why it wasn't working was because the input was faulty. The script ...
user avatar
  • 169
2 votes
0 answers
32 views

Switch between virtual desktops by scrolling on the menu bar

Looking for a script, macro, automation script, TIY solution that will allow me to hover my mouse over the menu bar scroll my mouse wheel up and down which in turn will switch between my left and ...
user avatar
0 votes
1 answer
25 views

I'd like to change the shell script instruction to the one available in the terminal

do shell script "bless -mount /Volumes/BOOTCAMP/ -legacy -setBoot -nextonly" password "0000" with administrator privileges tell application "System Events" restart ...
user avatar
0 votes
0 answers
26 views

Bring PID's window into focus from Bash script

I'm writing a little script to run when a Windows/Wine-turned-macOS(using-Automator) app is opened. To keep it light, the app does not bundle Wine, instead the script checks if it's (Wine) installed ...
user avatar
  • 163
0 votes
3 answers
347 views

macOS doesn't run executable file anymore, after upgrade to Catalina/Monterey

Since I upgraded to Monterey (from Mojave), I cannot run anymore a local server that was installed under /Applications. The app has no extension, the file type is "Unix Executable File". It ...
user avatar
0 votes
0 answers
31 views

AppleScript; How do I run tell command when a specific text within a folder exists?

I just learned how this coding thing works today so bare with me if I go all noob on you & feel free to put me in my place for which I'm misinformed; tell me what's up ;) I have made a .app that ...
user avatar
2 votes
0 answers
86 views

How can I add shells to the list in Run Shell Script in the Automator now that the .plist is on the read-only volume?

This question has what seems like a duplicate here, but I have an update. The answer to that question -- how to add a shell to Automator -- is to modify Shells.plist. Specifically: The list of these ...
user avatar
0 votes
1 answer
38 views

How to open a network share with the "open" command and not create a Finder window?

My Mac runs a daily script (via cron) that mounts an AFP network share on a remote server, writes to it, and unmounts the share. Unfortunately, the script has a side-effect of opening a Finder window ...
user avatar
  • 113
2 votes
2 answers
74 views

What is the javascript equivalent of the applescript run command?

I want to create a script for opening an app in nonstandard location quickly. With AppleScript, the app can be started with: tell application [app path] to run I want to do the same using javascript ...
user avatar
  • 139
4 votes
1 answer
154 views

Programs don't show up in jobs if I start them in the background with a shell script

I want to launch a three programs (2x streamlit, 1x python) in the background with a shell script: #!/bin/sh cd /Users/mc/src/crypto/ || exit streamlit run dashboard.py & streamlit run ...
user avatar
  • 143
0 votes
0 answers
34 views

Adobe Bridge Javascript works on Windows but not Mac

I have a bridge script here that I have been running on Adobe Bridge 2022 for Windows but when I tried to run it on an imac it did not work. I have never had issues with using photoshop scripts on ...
user avatar
15 votes
3 answers
2k views

What are the downsides of putting GNU coreutills first in ${PATH}?

I'm coming from Linux to macOS, and many of my scripts assume GNU versions of the utils provided in GNU coreutils. I could just put the GNU coreutils bin directory in earlier in $PATH than /bin. Is ...
user avatar
  • 281
3 votes
1 answer
391 views

How can I generate multiple hashes in Mac terminal for multiple files?

Suppose I have multiple files in my folder: HuZhou_1_d1_Clean_Data_unaligned.fq.2.gz HuZhou_1_d1_Clean_Data_unaligned.fq.1.gz HuZhou_1_d1_Clean_Data_unaligned.fq.3.gz ...
user avatar
  • 133
0 votes
0 answers
29 views

Is there a way to launch an application on a particular display?

I'm considering writing a script that would open a bunch of apps. For example, it would open Slack on my secondary display, Chrome on a primary and Firefox on a third one. Right now, I can open a file ...
user avatar
2 votes
1 answer
132 views

How can I programmatically test if the ISRG Root X1 certificate is present and trusted in Keychain Access?

On September 30, 2021, the DST Root CA X3 expired, and left macOS 10.11 and older unable to connect to any HTTPS servers which use Let's Encrypt by default. One easy way to fix this is to manually add ...
user avatar
  • 6,189
1 vote
1 answer
107 views

Creating a shortcut to connect to my iPad over USB and extend display

I want to use the new OS Shortcuts feature to be able to push command-D on my keyboard to automatically extend my display to my iPad over USB instead of having to open System Preferences/Displays and ...
user avatar
  • 11
1 vote
0 answers
53 views

Creating conditional script for softwareupdate command

Looking to create a script that runs a function if there are software updates available. Currently I am just using this: softwareupdate -ia && myFunction This creates my desired effect, but ...
user avatar
1 vote
1 answer
459 views

Permanently change zsh environment variable on macOS Big Sur?

I tried to customize the ZSH terminal shell (e.g. prompt, auto-completion behavior) by editing the ZSH files, but failed. I have tried both the following, and none worked: Edit ~/.zshrc: When I tried ...
user avatar
1 vote
1 answer
137 views

How to launch two terminal commands with delay thru applescript or automator?

I need to launch two terminal commands thru applescript/automator with delay between them. Absolutely don't know how to do it thru applescript, so I tried to do it thru automator and here what it ...
user avatar
  • 13
3 votes
0 answers
56 views

Detect macOS beta using script

In a shell script, how can I tell whether or not the script is running on a (public) beta version of macOS? Preferrably, I would like to check this without matching a specific version of macOS, since ...
user avatar
0 votes
0 answers
26 views

How to create a file that will start 3 different instances of iTerm (or 3 different windows in iTerm) and run a command in each one of them?

Every time I restart my mac I have to open a bunch of iTerm windows/split panes and in each one of them run some commands to start my project. How can I do that in macOS?
user avatar
  • 11
0 votes
0 answers
38 views

How to execute rc.local at boot

Found this in an old threat. But it did not work as described here. What I want to do in the end is to start my own daemon from rc.local. I am running OSX 11.5.2. So I created the file ls -l /Library/...
user avatar
  • 1
0 votes
0 answers
30 views

Check that a network Mac is powered on (to start backing it up)

I have recently installed in my home's basement near my router an old iMac on High Sierra to be a server helping the other macs. This server is always on and running. It performs certain current tasks ...
user avatar
0 votes
0 answers
9 views

local music app api for updating playlists and track ratings

are there any APIs/ Library Parsers/ programmatic ways to: create playlists (ideally in playlist folders) update playlist contents update track ratings or actually any kind of resources on how to do ...
user avatar
  • 111
0 votes
0 answers
27 views

How to autostart and repeat a script on macOS login

I'm using Emacs mu4e, it needs an external program like getmail to fetch POP3 emails. I need to execute a shell script command: getmail --getmaildir=~/.config/getmail/ --rcfile=example@gmail.com How ...
user avatar
0 votes
0 answers
31 views

Is there a good way to automate periodic exporting from the Stick 'em Up application?

I'm using an application like Sticky Notes (Stick 'em Up) which has an export feature. I would like to automate a nightly export of the contents. What's the best technology for this - Automator, ...
user avatar
0 votes
0 answers
31 views

The Automator website search service I found on AskDifferent breaks in Apple Music/iTunes, how do I fix it?

I made a shortcut to run from the contextual menu. I want to use it in iTunes Apple Music to search discogs for certain albums and singles. I copied this workflow. I modified the code to suit my ...
user avatar
0 votes
2 answers
207 views

macOS shell script check. A better way to execute the if statement and check for a condition

I need to write a very simple shell script that will check if the system is configured to enforce multi-factor authentication. To verify that the system is configured to enforce multi-factor ...
user avatar
0 votes
0 answers
69 views

Where to find the unread message count in chat.db for messages.app

I'm trying to find the number of unread messages in messages.app. The number should match the number on the badge of the app. I've approached this by accessing chat.db, a sqlite db which lists all ...
user avatar
  • 1
0 votes
1 answer
29 views

Can't use "open location" when it's part of a longer script

The following script works fine to open a URL in my default browser: open location "https://google.com" However, I've got an existing script to grab a URL from my Terminal window to open it ...
user avatar
  • 103

1
2 3 4 5
15