Files
runner-images/images/macos/scripts/build/configure-max-files-limitation.sh
Alexey-Ayupov 5a6e215859 [macOS] Refactor the rest of the scripts (#9113)
* [macOS] Refactor the rest of the scripts

* Return quotes to config tccdb script

* Return quotes to config tccdb script

* Revert some changes in ruby scripts

* Revert some changes in ruby scripts

* Revert some changes chrome script

* check errors

* check errors 01

* find errors in common-utils

* find errors in edge install

* find errors in edge install

---------

Co-authored-by: Alexey Ayupov <“alexey.ayupov@akvelon.com”>
2024-01-09 14:47:31 +01:00

45 lines
1.4 KiB
Bash

#!/bin/bash -e -o pipefail
################################################################################
## File: configure-max-files-limitation.sh
## Desc: Configure max files limitation
################################################################################
Launch_Daemons="/Library/LaunchDaemons"
# EOF in quotes to disable variable expansion
echo "Creating limit.maxfiles.plist"
cat > ${Launch_Daemons}/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>Program</key>
<string>/Users/runner/limit-maxfiles.sh</string>
<key>RunAtLoad</key>
<true/>
<key>ServiceIPC</key>
<false/>
</dict>
</plist>
EOF
# Creating script for applying workaround https://developer.apple.com/forums/thread/735798
cat > /Users/runner/limit-maxfiles.sh << EOF
#!/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
echo "limit.maxfiles.plist permissions changing"
chown root:wheel "${Launch_Daemons}/limit.maxfiles.plist"
chmod 0644 ${Launch_Daemons}/limit.maxfiles.plist
echo "Done, limit.maxfiles has been updated"