Scripting Terminal Command with Automator I am trying to automate a set of terminal commands. I was given the below instructions and manually doing it works just fine, but I wanted to know if there was a way to use the Mac "Automator" on my Mac to make a script/batch so all I have to do is click on it to apply all of these no matter what computer I want to run it on. Is that possible? (see below)



If the error persists, please try running these commands at the terminal to see if that corrects the issue: 

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;eicar&lt;/string&gt;
    &lt;key&gt;ProgramArguments&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;/bin/launchctl&lt;/string&gt;
        &lt;string&gt;limit&lt;/string&gt;
        &lt;string&gt;maxfiles&lt;/string&gt;
        &lt;string&gt;16384&lt;/string&gt;
        &lt;string&gt;16384&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;RunAtLoad&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;ServiceIPC&lt;/key&gt;
    &lt;false/&gt;
 &lt;/dict&gt;
 &lt;/plist&gt;



Launch Terminal
Type sudo su then enter your password to log in as root
Type vi /Library/LaunchDaemons/com.apple.launchd.limit.plist
When in the vi editor, press i to enter insert mode then paste the exact code content above (Cmd-V). This will force the limit to 16384 files per process and 16384 files total
Save your file and quit using Esc followed by :wq
Reboot your system, and check that it is working using the command launchctl limit
Here is a Automator task that can help you with.

1. Action: Get text
To do: Copy and paste desired text content.  



2. Action: New text file
To do: File format 'simple text'; save as 'automatortempfile.txt'; In Where is tricky, when you click will show a select folder location, press Cmd+Shift+g and type /var/tmp.  



3. Action: Execute Applescript
To do: Copy and paste this content.  

tell application "System Events"
    activate
    return text returned of (display dialog "Enter password" default answer "" with hidden answer)
end tell


This will open a dialog with a message "Enter password", that you must provide user password (this user must have admin rights, because this is required to write in /Library/* folder).



4. Action: Execute shell script
To do: Copy and paste this content.  

sudo -S mkdir -p /Library/LaunchDaemons
sudo -S mv /var/tmp/automatortempfile.txt /Library/LaunchDaemons/com.apple.launchd.limit.plist


First line: Create a folder LaunchDeamons if doesn't exist (just for ensure that folder exists).
Second Line: Move your created file automatortempfile.txt from /var/tmp folder to /Library/LaunchDaemons/ and rename it to com.apple.launchd.limit.plist.

sudo -S will read password from stdin.



Now, just save and use!