Files
runner-images/images/macos/scripts/build/configure-max-files-limitation.sh
T

45 lines
1.4 KiB
Bash
Raw Normal View History

#!/bin/bash -e -o pipefail
2023-11-28 02:25:03 +01:00
################################################################################
## File: configure-max-files-limitation.sh
## Desc: Configure max files limitation
################################################################################
2020-09-10 14:34:08 +03:00
Launch_Daemons="/Library/LaunchDaemons"
# EOF in quotes to disable variable expansion
echo "Creating limit.maxfiles.plist"
cat > ${Launch_Daemons}/limit.maxfiles.plist << EOF
2020-09-10 14:34:08 +03:00
<?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>
2023-08-30 12:51:14 +02:00
<key>Program</key>
<string>/Users/runner/limit-maxfiles.sh</string>
2020-09-10 14:34:08 +03:00
<key>RunAtLoad</key>
<true/>
<key>ServiceIPC</key>
<false/>
</dict>
</plist>
EOF
2023-08-30 12:51:14 +02:00
# Creating script for applying workaround https://developer.apple.com/forums/thread/735798
cat > /Users/runner/limit-maxfiles.sh << EOF
2023-08-30 12:51:14 +02:00
#!/bin/bash
sudo launchctl limit maxfiles 256 unlimited
sudo launchctl limit maxfiles 65536 524288
EOF
echo "limit.maxfiles.sh permissions changing"
chmod +x /Users/runner/limit-maxfiles.sh
2023-08-30 12:51:14 +02:00
2020-09-10 14:34:08 +03:00
echo "limit.maxfiles.plist permissions changing"
chown root:wheel "${Launch_Daemons}/limit.maxfiles.plist"
chmod 0644 ${Launch_Daemons}/limit.maxfiles.plist
2020-09-10 14:34:08 +03:00
echo "Done, limit.maxfiles has been updated"