The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
52
votes
10answers
28k views

How can I change a file or folder icon using the Terminal

How can I change or set the icon for a file or folder, in the terminal, do I need to use a scripting language?
48
votes
6answers
41k views

Possible to run scripts on sleep and wake?

MacBook Pro 2010 running OS X Lion. Is it possible to run scripts on sleep and wake events? My specific application is that I've got Dropbox-synced Truecrypt volumes that I regularly use on both my ...
11
votes
1answer
5k views

Is there a script I can use to download the Mojave installer without being signed in to the App Store?

Is there a way to script and download the Mojave installer without signing in to the App Store? Something other than opening or clicking a url that points to the installer on the Mac App Store would ...
19
votes
4answers
17k views

My Automator Workflow fails because it fails to find the git command within the 'Run Shell Script' command? Need help

I have an Automator workflow and one of the actions is to clone a repository. Here's the code for the 'Run Shell Script' action. The command is run within the Bash shell /bin/bash if that matters: ...
13
votes
5answers
14k views

Make a script/app run on logout

We all know that Mac OS X has the very useful Login Items functionality which lets you, among other things, set up apps/scripts to run when you log in. I'm looking for a way to setup a list of ...
8
votes
4answers
6k views

Programmatically/Script-atically changing the default Open-With setting

Is there a way to change what app opens a file type programmatically/with a script? Basically, sometimes I'm working on a web site, and I want to set all web files to open with a text editor (*.php, *...
2
votes
1answer
17k views

How to create an Automator service to run a script on all files in a folder

I want to create a service using Automator to run a shell script on all files in a folder, say delete all log files. What I have done is Created a new service in automator. Added a "Run Shell Script"...
28
votes
7answers
62k views

How to send an email from command line?

How to send an email from command line or script? I want to be able to run the script programmatically by passing the receiver and the message.
18
votes
7answers
41k views

How to persistently define aliases in Terminal

I want to add aliases to my environment so that they are available in all Terminal instances. I got this answer: Yes, you can put it in your .bashrc, .bash_profile or .profile. On some systems the ...
30
votes
7answers
79k views

Way to logout a user from the command line in OS X 10.9

I want to logout my Mac OS X from the command line. My OS X version is 10.9. I tried command pkill -KILL -u uid, but this command didn't work out. Is there a command that can be used to log out a user ...
8
votes
4answers
11k views

Checking for folder/file changes using Automator?

Is there there a way to check a folder/file for changes (includes adding files, deleting files, changes in files,...). The 'Folder action' in Automator is only checking if any files are newly added.
4
votes
2answers
3k views

Run script before restart/shutdown

Is it possible to execute a script/command right before OS X is shutting down or restarting? I'd like to run sudo apachectl stop to stop apache from auto-starting.
25
votes
6answers
12k views

Toggle “Use all F1, F2 as standard keys” via script

I toggle the "Use all F1, F2 as standard keys" setting very often and would like to automate it via a script (or a keyboard shortcut). Is it possible? I've tried to Google the right arguments for ...
10
votes
4answers
12k views

Run Script on Logout Without Use of Logout Hook

I've been looking into running a few cleanup commands when a user logs out, however the old logout hook feature, although still functioning, has been deprecated for some time now so may not be with us ...
22
votes
1answer
79k views

Full privileges on .command file, but it says I don't have appropriate privileges

I have a command that I regularly need to run in the Terminal (for application code signing). Normally I launch the Terminal, press the up arrow until I reach the command I want, and then hit enter. ...
7
votes
3answers
27k views

How to run a shell script from an AppleScript?

I am using a Mac running OSX Yosemite v.10.10.5. When I try to run my shell script from my AppleScript, I get the following error message: Error message at AppleScript Script Editor error "sh: /...
12
votes
6answers
7k views

Getting notified when someone logs into a server using SSH or Remote Desktop

I have a mac mini server running OS X Lion Server 10.7.3. It pretty much runs unattended without problems. However, the server is under constant "attack" according to the logs. The firewall and ...
8
votes
3answers
2k views

Lock screen with LaunchBar

I extensively use Launchbar and have almost all my daily productivity items working through it. Since I use my personal MacBook at work, I do not have use a screen saver password, however, when at ...
5
votes
3answers
3k views

What scriptable OCR Software exists on OSX for a paperless office [duplicate]

I'm planning to get a paperless office and for that, I a need good scriptable piece of OCR for OS X? I've read a blogpost by Marco Arment about a few programs. Are there any workable ones there that ...
1
vote
2answers
6k views

Setting a firmware password

Currently trying to use a script (preferably shell) to setup the firmware password on a fresh OSX install. I obviously found this: http://osxdaily.com/2014/01/06/set-firmware-password-mac/ which ...
4
votes
2answers
5k views

Display dialog from command line (like xmessage does)

Background I'd like to be able to display a notification window in OS X from within a script. The script will be running in background, so the notification should not go to the terminal but instead ...
2
votes
1answer
318 views

Can automation service to get the parent folder path?

I already have a service that will create a network file:/// link to a share point over AFP but I would like to have one that does the parent folder of a file. If I right click a file I would like to ...
2
votes
3answers
164 views

Script to relocate the menu-bar on dual monitors set-up

Is there a script that could be written to achieve this: In System Preferences/Displays... is it possible to relocate the menu bar ...via a script? My set-up is one monitor and a Cintiq. I either work ...
2
votes
2answers
1k views

Command Line method to backup using two Time Machine disks

Does anyone know of a command line method to select the active Time Machine disk? I would like to alternate between two backup disks for redundancy. I would like this to be automated, presumably via ...
2
votes
2answers
1k views

How do I get Automator to process images using ImageMagick in a command script?

I'm making an Automator workflow that uses the shell script action to process a selection of images with the imagemagick composite command. Only I'm having issues getting it going. According to the ...
2
votes
1answer
258 views

Configure the OS X Server from .pkg postinstall script

I make a .pkg-installer for a product that extends the Apache server in OS X. From the postinstall script in the .pkg I'm currently able to configure the default setup of Yosemite and El Capitan, by ...
20
votes
4answers
20k views

Mojave: disable or control the “[SOME_APP_NAME] wants access to control [ANOTHER_APP_NAME (often Finder)] …”?

A new security feature in Mojave revolves around a system dialogue that prompts you to grant access to apps that want to control other apps, such as Finder (I'm finding frequently happening with some ...
9
votes
3answers
2k views

Enable/disable Time Machine depending on network connection type

I've not got a great Wi-Fi setup here at home and it sometimes results in failed Time Machine backups. Is there a way of specifying that Time Machine only backs up under certain circumstances - i.e. ...
5
votes
3answers
10k views

How can I use Terminal to monitor a network interfaces total traffic in Mb

I would like to use the terminal to monitor the network traffic on a given interface, with a view to providing alerts when certain cumulative totals have been exceeded. The script needs to gain ...
8
votes
4answers
27k views

How do I create an AppleScript that will quit an application at a specific time and then put the computer to sleep?

I've been toying around with AppleScript and Automator to get this thing to work, but I just can't seem wrap my head around it. If anyone could show me an example or give me some tips on how I can set ...
8
votes
1answer
6k views

Turn on Back To My Mac via a Script or Command Line

The VPN software I use for work (IPSecuritas) requires me to turn off Back To My Mac to start it's connection, so I frequently turn off Back To My Mac in order to use my VPN connection (the program ...
6
votes
1answer
23k views

How do I remove a user via single user mode in 10.7?

I occasionally will setup a user's machine that has been in for repair beyond the simple re-install of the OS. For example: install a new hd, install the OS, create a user, install updates and then ...
6
votes
3answers
7k views

Opening a terminal window to a specific directory from a bash script

How can I write a bash script in Mac OS X that opens a Terminal window in a specific directory? I'd assume something like: open /Applications/Utilities/Terminal.app But that does nothing (maybe it'...
26
votes
4answers
20k views

Where is my crontab file?

I want to edit my crontab file to schedule a script. Where do I find it?
9
votes
1answer
933 views

What are the differences between Applescripts saved as *.scpt and *.applescript?

It seems to me that those scripts that are saved as *.applescript are always meant to be the raw, uncompiled text while those that are saved as *.scpt can be either the raw text or the compiled ...
3
votes
1answer
5k views

How to make a playable DVD iso from a VIDEO_TS folder?

I used to have a script that converts a VIDEO_TS folder into an ISO that plays ok in VLC but it's gone. Anyway, this command gets me most of the way there: hdiutil makehybrid -udf -udf-volume-name $...
7
votes
3answers
9k views

How to disable individual USB ports by script?

I am looking for a script which will allow me to disable one specific USB port on my Mac mini. It would only serve a purpose if it works in real-time and didn't require a reboot. I've found scripts ...
5
votes
4answers
8k views

Problem with startup `rc.local` script

Until OS X 10.9 I could also run Bootcamp within Virtualbox (through a .vmdk file). In order to do this, I needed to unmount the Bootcamp partition after changing the permissions during the OS X ...
4
votes
1answer
4k views

Fake.app: How to loop thru the rows in a CSV file and use the data in my Workflow?

I am using Fake to automate some web tasks. I have a CSV file on disk that contains rows of data which I'd like to use to fill out forms in my Fake Workflow. How can I iterate thru the rows in the ...
3
votes
2answers
1k views

How to use AppleScript in a bash script to create an alias for an app?

I need to create an alias on my Desktop to an app in my Applications folder, using a bash script file. As far as I know, it's only possible with AppleScript. Unfortunately, my AppleScript skills are ...
2
votes
1answer
2k views

Running a gpg shell script to decrypt a file via Automator

I regularly need to decrypt a gpg-encrypted file (always the same) to simply view it in TextEdit. I have a very simple shell script for that. It looks like this: #!/bin/sh outfile=`mktemp -t $$` # ...
2
votes
1answer
188 views

Disable badge for specific app with a script

I know that I can turn on/off the badge from the notifcation center, but is there a way to do it with a script? If possible I would love to do for a specific app, otherwise it will be fun to turn it ...
1
vote
3answers
1k views

AppleScript – How can I _get_ UI elements' names, attributes, properties, classes programmatically without “guessing” via AccessibilityInspector?

When I started to search for an AppleScript's generic way to "click onto Safari's context menu" of a selected item, there were a lot of questions on "how-to" on several levels of nomenclature. How ...
12
votes
1answer
934 views

Replace password prompt with Touch ID to read Keychain password

I'm using the following command to fetch a password from the Keychain in a shell script: security find-generic-password -w -s "MyServiceName" It works, but it's showing a popup window asking me for ...
6
votes
6answers
9k views

How to launch browser in iOS Simulator from command line?

I want to launch the browser in iOS Simulator from the Terminal with specified URL. Is there any command for it? So that I can write in a script which will take URL as argument and launch simulator ...
4
votes
1answer
878 views

How can I automatically download multiple sites through Coda?

I have several sites in Coda that I would like to automatically re-download when I tell it to. The sites are collaboratively managed, and I'd like to download a fresh copy of the sites automatically. ...
4
votes
1answer
130 views

Automate Yosemite Upgrade

I want to be able to launch the Yosemite Installer app from the Applications folder and install the upgrade with commands. When I look inside the InstallESD.img there are many PKG files, I am unsure ...
4
votes
3answers
5k views

How can I enable SSH without using the gui or apple script on snow leopard?

A while back here How can I enable Internet sharing without using the GUI or AppleScript? I asked if any one knows how to enable Internet sharing without using GUI or apple script, I still have that ...
4
votes
1answer
2k views

How do I script Powerpoint to save a directory of PPTX files as PDFs?

If I have a directory of PPTX files I would like to save as PDFs. How do I script this operation?
3
votes
1answer
1k views

How to increase cursor size programmatically?

How do I increase the cursor size programmatically? I know how to do it manually. Is there a script that can do it from the command line rather than an AppleScript that does it from the GUI. Why? I ...