Skip to content

Instantly share code, notes, and snippets.

@karstengresch
Forked from Maarc/ulimit.sh
Created February 14, 2020 11:28
Show Gist options
  • Save karstengresch/c74a7c95aabb23a1d0c9e9de210c4985 to your computer and use it in GitHub Desktop.
Save karstengresch/c74a7c95aabb23a1d0c9e9de210c4985 to your computer and use it in GitHub Desktop.
Bash script updating the ulimits
#!/usr/bin/env bash
# Automating https://blog.dekstroza.io/ulimit-shenanigans-on-osx-el-capitan/
echo "Updating the ulimits on OSX to be able to run RHAMT tests."
sudo bash -c 'cat >/Library/LaunchDaemons/limit.maxfiles.plist <<EOF
<?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>limit.maxfiles</string>
<key>ProgramArguments</key>
<array>
<string>launchctl</string>
<string>limit</string>
<string>maxfiles</string>
<string>524288</string>
<string>524288</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>ServiceIPC</key>
<false/>
</dict>
</plist>
EOF'
sudo bash -c 'cat >/Library/LaunchDaemons/limit.maxproc.plist <<EOF
<?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>limit.maxproc</string>
<key>ProgramArguments</key>
<array>
<string>launchctl</string>
<string>limit</string>
<string>maxproc</string>
<string>2048</string>
<string>2048</string>
</array>
<key>RunAtLoad</key>
<true />
<key>ServiceIPC</key>
<false />
</dict>
</plist>
EOF'
sudo launchctl load -w /Library/LaunchDaemons/limit.maxfiles.plist
sudo launchctl load -w /Library/LaunchDaemons/limit.maxproc.plist
echo "Please restart your system to make the changes effective."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment