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:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>eicar</string>
<key>ProgramArguments</key>
<array>
<string>/bin/launchctl</string>
<string>limit</string>
<string>maxfiles</string>
<string>16384</string>
<string>16384</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>ServiceIPC</key>
<false/>
</dict>
</plist>
- 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
Best Answer
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.
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.
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 tocom.apple.launchd.limit.plist
.sudo -S
will read password from stdin.Now, just save and use!