forked from clouseau/macports-lamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathincrease_limits
executable file
·58 lines (46 loc) · 1.7 KB
/
increase_limits
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
if [ -z $SUDO_USER ]; then
echo "Please run the script using sudo, e.g.,"
echo ""
echo "sudo ./increase_limits"
exit 1
fi
echo "Your current limits:"
launchctl limit | grep max
if [[ `csrutil status` == 'System Integrity Protection status: enabled.' ]]; then
echo
echo "Noting that System Integrity Protection (SIP) is enabled."
echo "You should not need to disable it for limits changes to take effect."
echo
fi
echo
echo "Your current maxfiles limits (soft limit on the left, hard limit on the right):"
launchctl limit | grep maxfiles
echo
echo "Would you like to set maxfiles to 10240?"
read -p "Are you sure? (y/n) " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
cp ./limit.maxfiles.plist /Library/LaunchDaemons/limit.maxfiles.plist
chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist
chmod 644 /Library/LaunchDaemons/limit.maxfiles.plist
echo
echo "New maxfiles limits have been set. A reboot will be required for them to take effect."
else
echo
echo "Action aborted. maxfiles limit settings have not been changed."
fi
echo
echo "Your current maxproc limits (soft limit on the left, hard limit on the right):"
launchctl limit | grep maxproc
echo "Would you like to set maxproc to 2048? (Only do this if your soft limit is less than 2048.)"
read -p "Are you sure? (y/n) " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
cp ./limit.maxproc.plist /Library/LaunchDaemons/limit.maxproc.plist
chown root:wheel /Library/LaunchDaemons/limit.maxproc.plist
chmod 644 /Library/LaunchDaemons/limit.maxproc.plist
echo
echo "New limits have been set. A reboot will be required for them to take effect."
else
echo
echo "Action aborted. maxproc limit settings have not been changed."
fi