Replies: 12 (Who?), Viewed: 5905 times.
Field Researcher
Original Poster
#1 Old 27th Feb 2018 at 12:42 AM Last edited by muridae : 22nd Jul 2020 at 7:13 PM.

This user has the following games installed:

Sims 2, University, Nightlife, Open for Business, Pets, Seasons, Bon Voyage
Default Tutorial: Sims 2 Super Collection for Mac - Increasing the Maximum File Limit
{As discussed earlier in Stupid/Random Questions, this is the first of what will probably be several Mac-focussed guides on how to tweak the game. Please move it to the appropriate place, then I'll delete this preamble. There are 7 inline images, which I hope isn't excessive for a tutorial.)

Update 08/05/2018: PDF version of the tutorial added.
Update 13/05/2020: Images re-uploaded, since the modyourpanties versions went away.
Update 22/07/2020: Information about increased maxfiles and maxproc limits at higher versions of macOS added.

NOTE: This information is mostly for Mac Sims players running 10.11 (El Capitan) or 10.12 (Sierra). OS X 10.9 (Mavericks) and 10.10 (Yosemite) work differently - see the link at the end for information on how to increase the limit for them. 10.13 (High Sierra) has increased limits, though they may still be low enough that you might want to increase them. 10.14 (Mojave) has even higher limits, to the point where it becomes increasingly unlikely that a player will hit them.

macOS versionkern.maxfilesperprockern.maxfileskern.maxprocperuidkern.maxproc
10.12 (Sierra) and below10240122887091064
10.13 (High Sierra)184323686410641596
10.14 (Mojave)368647372821283192

Background

By default the maximum number of files a modern Mac can open is set to 12,288, and the maximum files a single process (for instance, Sims 2) can open is set to 10,240. Most applications won’t ever need more than that. Sims 2, of course, is pretty greedy about resources on your computer in general, and if you want to add a lot of custom content then all those little *.package files add up. If you go on a download spree you can find yourself hitting that upper limit pretty quickly.

That wouldn’t be as big a problem if the game just complained and crashed. Unfortunately, if you attempt to load more files than your maximum limit the game will just skip loading some of them. If you’re unlucky, those skipped files can leave you with missing Sims and missing lots and a corrupt neighbourhood.

If you want to minimise your risk without making drastic changes the easiest thing you can do is delete any premade neighbourhoods you have no intention of playing. It’s easy to get them back again, either by selecting Options → Game Settings on the launcher and then “Restore Neighborhood: name” from the Game Utilities dropdown, or by installing a clean template. But leaving them there can add hundreds of files per neighbourhood to your open files count.

If you want a lot of custom content and you want to play several different neighbourhoods though, you’re probably going to want to increase that maximum file limit.

Increasing the OS X/macOS File Limit

The first thing to do is to check what your current file limit is. Go to Applications -> Utilities and launch the Terminal app, which looks like this:



Cut and paste the commands below into Terminal (you can either do it as one block or a line at a time):

Code:
launchctl limit|grep maxfiles
sysctl kern.maxfilesperproc
sysctl kern.maxfiles
launchctl limit|grep maxproc
sysctl kern.maxproc
sysctl kern.maxprocperuid 

What you’ll probably see, if you’ve not made any amendments to the file limits before, is this:



kern.maxfilesperproc is the maximum number of files a single process (e.g. Sims 2) can use
kern.maxfiles is the maximum number of files your entire system can use
kern.maxprocperuid is the maximum number of processes your user can use
kern.maxproc is the maximum number of processes your entire system can use

These are the values we’re going to change.

Unzip the attachment (maxfiles_maxproc_plist.zip). This contains two files limit.maxfiles.plist and limit.maxprocs.plist. If you open them in a text editor, they look like this:

limit.maxfiles.plist:


65536 is the value for kern.maxfiles. I've been unable to find the official upper limit but I wouldn't add more than this unless you have huge amounts of RAM to cope with it as it'll increase demand on your system resources. If you think it’s too much, you can edit the file and change it to a smaller number, such as 20480.

63488 is the value for kern.maxfilesperproc. Keep this lower than kern.maxfiles, as that leaves room for the operating system and other applications to open files as well. I would subtract 2048, as macOS does. So, if you set kern.maxfiles to 20480, kern.maxfilesperproc should be 18432.

limit.maxproc.plist:


2500 is the largest value you can set for kern.maxproc and kern.maxprocperuid. If you set it any higher (or to unlimited) macOS will ignore the settings entirely. Again, you can edit the file and set it lower if you want.

The two plist files now need to be placed in /Library/LaunchDaemons so that they run when your Mac boots up. Drag the files from where you unpacked them to /Library/LaunchDaemons. Because this is a system folder, you’ll get a prompt to confirm the file move with your administrator username and password, like this:



Click on AUTHENTICATE.



Type in your administrator password, then click OK.

The files are now in the right place, but they need to have their permissions changed so that they run as the system rather than your user account.

Open Terminal again, and change owner and group to root:wheel and file access permissions to 644:

Code:
sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist 



You’ll be prompted for your Administrator password details at this point. Type it in and hit enter.

Make the remaining changes (shown below). You shouldn’t be asked for your password again.

Code:
sudo chown root:wheel /Library/LaunchDaemons/limit.maxproc.plist
sudo chmod 644 /Library/LaunchDaemons/limit.maxfiles.plist
sudo chmod 644 /Library/LaunchDaemons/limit.maxproc.plist 

Check that the file permissions are now correct by typing this:

Code:
ls -l /Library/LaunchDaemons/limit.max*.plist 

They should look like this:



You now need to restart your Mac in order to pick up the new file limit settings.

Once the reboot is complete, open Terminal again and cut and paste the commands to check your max files settings again:

Code:
launchctl limit|grep maxfiles
sysctl kern.maxfilesperproc
sysctl kern.maxfiles
launchctl limit|grep maxproc
sysctl kern.maxproc
sysctl kern.maxprocperuid 



You should now see that they match the numbers in the two new plist files. Congratulations, you’ve increased the file limit on your Mac.

Resetting the File Limit

If you ever decide that you don’t want the increased file limits, you can get rid of them by going to /Library/LaunchDaemons and deleting limit.maxfiles.plist and limit.maxproc.plist. You’ll be asked to type in your Administrator password to do so. Empty trash to delete the files, then reboot, and you should be back to the default macOS file limits again.

Further Information

http://bunsim.tumblr.com/MacFileLimitHelp (background information, and the different method of increasing file limits for OS X 10.9/Mavericks and 10.10/Yosemite)
http://www.insimenator.org/index.ph...html#msg1628939 (increasing file limits for OS X 10.11/El Capitan and above)
Screenshots
Attached Images
 
Download - please read all instructions before downloading any files!
File Type: zip maxfiles_maxproc_plists.zip (899 Bytes, 99 downloads) - View custom content
Description: plist files
File Type: zip Sims 2 Super Collection for Mac – Increasing the Maximum File Limit.pdf.zip (250.8 KB, 74 downloads) - View custom content
Description: Tutorial in PDF form
Advertisement
Field Researcher
#2 Old 27th Feb 2018 at 9:19 PM
Logged in just to tell you I REALLY appreciate this thread.



I play on a Mac and have encountered some terrible issues that i think are related to this.

MTS does not allow us to delete our accounts. I will not be logging into this account anymore, so PMs would go unanswered.
Test Subject
#3 Old 27th Feb 2018 at 10:15 PM
Ah you did it!!! Thank you sooooooo much!!! I will be trying this later.
Test Subject
#4 Old 8th May 2018 at 9:51 PM
Ahhhh I stopped messing with this for awhile and never tried doing this till now. Unfortunately a couple of the images you posted of the codes to enter in terminal are not showing up!! Could you possibly repost those? I'm at the part where my files are in the right place, I just need to change the permissions. I know it's been awhile since you posted this but I would be so grateful!! Thanks so much again for taking the time to post this thread
Field Researcher
Original Poster
#5 Old 8th May 2018 at 10:17 PM
Hi @mxyx -

The images were uploaded to modyourpanties.com, which isn't responding for me right now. That's probably why they're not showing up, but hopefully it's a temporary problem.

I still had my first draft of the tutorial as a Word file (including all the images at the appropriate points), so I've converted that to PDF, zipped it, and attached it to the thread. I don't guarantee that the wording is 100% identical, as I tweaked a few sentences after posting, but the code bits and the images should be.
Mad Poster
#6 Old 8th May 2018 at 11:15 PM
Yes, modyourpanties is down just now for me too. It was also down a few days ago, and some images in my posts weren't showing. But it came back again fairly quickly. Hopefully it will do the same again soon. If it stays down we should probably go to Site Issues.

All Sims are beautiful -- even the ugly ones.
My Simblr ~~ My LJ
Sims' lives matter!
The Veronaville kids are alright.
Test Subject
#7 Old 9th May 2018 at 5:32 PM
@muridae- wow thanks for the quick response! and for uploading the pdf. So I did everything in your steps, it looked right in terminal everything looked like your screenshots- however I am still not able to have as many package files in my downloads folder as I think I should (if I'm understanding things correctly). I was able to add more- 9600 package files to approx. 13,500 in my downloads folder- but any more than that and the issues of too many files become present. Do you have any ideas as to why this would be happening??

Also just so you know, I am so appreciative of your response to my first post and for this thread! I'm new to posting here (loooooong time lurker though) and you've made me want to keep up with it. :D
Field Researcher
Original Poster
#8 Old 9th May 2018 at 7:34 PM
To be honest I've not actually hit the upper limit of what I can put in game, as I still have my old Windows disks and Windows 7 in Bootcamp so have been busily packaging up all my recolours to keep the filecount as low as possible. I also play with Pescado's antiredundancy mods in and minimal townies most of the time, which keeps the Sim numbers down. File limits are something I've mostly hit in my day job, when I have my system/database administrator hat on.

How many hoods have you got in your game? They get scanned at startup, so I think they get included in the filecount, as does everything in the Sims 2 Super Collection package. I've taken to deleting any premade hoods I'm not actually playing, because that's a few thousand files right there.

I'm reasonably certain it's not an HFS limitation, but it's still a 32-bit app so could be hitting some limits from that.

(I think I lurked here for almost a decade before posting. Had my account deleted several times for inactivity and had to recreate it more than once. Fortunately I was always able to get my login name back.)
Field Researcher
#9 Old 3rd Jan 2021 at 6:24 PM Last edited by trambling101 : 3rd Jan 2021 at 9:39 PM. Reason: notes, research, & observations
Awesome thread, thanks so much for creating it! I enjoy the support for the Mac community and fortunately Aspyr is still offering support for this game. I'd love to see a tutorial on setting up SimPE on modern Mac as I never set it up and have really wanted to do so for a long time (alongside the other awesome softwares, i.e. Scriptorium, HoodChecker, etc.).

I've encountered this issue on a previous version of The Sims 2 for myself and tried to rectify it, however I don't think that I did it correctly previously. I have already maxed my file limit on The Sims 2 Super Collection (and have yet to really start playing the game). I've already downloaded several mods as recommended by this Essential Mods thread in order to prevent redundant files and have deleted some pre-made hoods as I have no intention of playing them. The indicator I find for reaching the max file limit is that pre-made houses/lots are not showing up in the bin (the bin only showed some Maxis pre-made ones), new lots won't save to the neighbourhood (they will place but disappear upon reloading the game), and neighbourhood pictures/videos are replaced with the blank template (they were restored upon reloading the game but disappeared after placing the lots). This was not new to me as it had occurred to me on my previous MacBook copy of the game as well. Previous to this, my game had crashed several times while during the initial game launch/loading screen process, right after I added a large amount of custom content to my Downloads folder. I ran some tests to see if it was the content itself or if it was specifically what I added and it pointed towards surpassing the limit beyond what the game could handle.

The strange thing is that my maxfilesperproc value is higher than what is indicated in your thread above and my Application Support file totals 11,075 individual files and lots in my bin are still missing. There may likely be some hidden files in the folder as well as that is often the case. I figure that I will still need to increase it as obviously I have hit some limit.

I have a 2017 MacBook Pro and am running on iOS 11.1 (Big Sur) and received the following values when inputting the commands into Terminal:
kern.maxfilesperproc: 24576
kern.maxfiles: 49152
maxproc: 2784
kern.maxproc: 4176

I'm wondering if I should only be altering my maxfiles in this case as my maxproc is a higher value than what is indicated in your thread/tutorial already? Let me know what you think.

EDIT: I just browsed through other posts in the "OS X Mac" section of the forum and it seems several threads have been created relating to this issue. This thread directs you to this amazing Tumblr post offering more insight on the Mac File Limit issue.

EDIT 2: I tried to temporarily raise only my maxfilesperproc using the command "sudo sysctl -w kern.maxfilesperproc=47104" but the game still crashes. I've also noticed that several character files have deleted and that the Burbs have showed up permanently in my Families Bin in my completely clean neighbourhood. I believe that the game can only process somewhere around 19k files (Application Contents & Application Support combined) regardless.

EDIT 3: The temporary fix may not work as iOS 10.11 (El Captain) and later as indicated by this post which requires System Integrity Protection to be disabled and re-enabled for the patch to work. The same link also provides support on how to do so. I'll need to try this out and confirm if it is effective. The 5k file difference still remains a mystery.

Call me Seth!
Field Researcher
#10 Old 16th Feb 2021 at 5:42 PM Last edited by trambling101 : 17th Feb 2021 at 1:56 AM.
I figured out how to back up my MacBook a few weeks ago and it turns out that Apple completely changed the method to do so on Big Sur (requires drives to have AFPS formatting bla, bla, bla).

As my game files were encroaching upon 10k files, I decided that it was necessary to try this out however I only added the limit.maxfiles.plist file as my maxproc numbers are higher than 2500. My current values are as follows:

kern.maxfilesperproc: 63488
kern.maxfiles: 65536
kern.maxproc: 4176
kern.maxprocperuid: 2784

I'm pleased to report that I believed it worked. I removed my current neighbourhood and regenerated the game-created Neighbourhood folder and there seems to be no issues. I have created an additional Test neighbourhood and have added approximately 1000 more files to my downloads folder as well (to around 9100 now). The total number of files in my 'The Sims 2' folder is now 11,063, compared to my previous file count of 9,993.

As of right now, I'm not aware of what the upper-limit could be, but I believe that it's likely best to keep the files under 15k in any scenario.


Edit: After dumping more CC to see if any effects would occur, the game crashed. I began to remove custom content and at 11,188 files in my folder it is noticeable that the file limit issues are still in effect (see attached images). I repeated the process and added the maxproc file (lowering my values to 2500 & 2500) yet the issue still persists. I also tried playing the game as well with System Integrity Protection disabled to see if there was a difference yet there wasn't any.

Edit 2: I tried to restore my previous hood yet experienced file-limit related corruption issues beyond 10,300 files (hood crashed on load + character files were deleted from the folder). I believe that this fix does not work on Big Sur.
Screenshots

Call me Seth!
Field Researcher
Original Poster
#11 Old 22nd Feb 2021 at 2:03 PM
Quote:
Originally Posted by trambling101
I tried to restore my previous hood yet experienced file-limit related corruption issues beyond 10,300 files (hood crashed on load + character files were deleted from the folder). I believe that this fix does not work on Big Sur.


That’s a shame.

I haven’t yet upgraded to Big Sur so haven’t tested this on that version yet, unfortunately. (I’m still trying to keep the 32-bit Sims 2 Stories games and the version of SimCity 2 that works for creating hood terrains alive, so am stuck at Mojave at the moment. I expect to upgrade next year when the Mojave security updates run out.)

You should definitely leave the maxproc settings at the Big Sur defaults, since bigger is better. I picked 2500 originally because I found in experimentation that any value higher than that would not work on the earlier OS X versions. The limits have been gradually rising with each new release since High Sierra, though it’s possible they may differ between machines depending on how much RAM you have.

kern.maxfiles is the maximum number of files that can be open on your computer simultanously, and will include all the files in the Sims 2 Super Collection package (about 6300 items), plus those opened in order to run the operating system and any other apps you might have running at the time. Closing as much other stuff as possible obviously helps to stay below that limit.

kern.maxfilesperproc is the maximum number of files that can be opened by one process - or in this case, Sims 2. So that value should always be lower, to give the operating system room to run, but this is the absolute limit that the game (which would include the app as well as your Sims 2 folder) can use.

If you’re experiencing crashes it could be that you’re running into a limit on how many open files your available memory can handle rather than the file limit you’ve set. It might be worth checking any dump reports you get for what they say about the error, or checking activity monitor or something like iStat Menus for your memory usage. If the new values are reported when you check them again after a reboot, then Big Sur is accepting the settings. That doesn’t mean it’ll play nicely with them, of course.

(My Sims 2 folder is currently only 6681 items, but I do have SimPE and my old Windows game installed on a Windows 7 VM, so wherever possible I drag new content across to that and bundle it into packages to reduce my filecount.)
Field Researcher
#12 Old 22nd Feb 2021 at 5:52 PM
Thanks for the reply, I'm fully convinced that it has something to do with all the new security enhancements introduced in Big Sur. I did some searching online and it seems like there's an extra lock and key that likely needs to be disabled now to allow the game to access a higher file limit. It's all relatively new information and I could not locate any people discussing file limit issues on Big Sur, so I have no idea if there even is a potential fix. Likewise, it seems like the heightened level of security may need to be permanently disabled but it seems a bit too risky just for a game like The Sims 2.

I do also have a Windows 7 VM running on Parallels with a copy of SimPE. I've just learnt how to use the program this past month and have noticed some downloads being both multiple and single package file sets. For example, I have a mix of face defaults from different creators, would I be able to compress those as you described? Have you used LazyDuchess' CCMerger Program as well? I'm curious if merging the files would work the same on both systems. Again, there's always the obvious risks with merging files together..

Call me Seth!
Field Researcher
Original Poster
#13 Old 23rd Feb 2021 at 5:49 PM
Some things work for bundling, some don't. Some things I bundle everything for a mesh together, and others I'll seperate it out into recolour sets - splitting them by creator, and sometimes by a particular set of recolours by a creator. That makes it very much easier for me to yank a set if I decide I don't want them, without having to go back through and tediously rebundle - or remove things from my Compressorized package and hope it doesn't break. :-)

Good guides on bundling:

https://hat-plays-sims.dreamwidth.org/34791.html (scroll way way down to "Bundling Package Files" though the rest is well worth a read too.
https://keoni-chan.tumblr.com/post/...cc-a-mini-guide

Returning to file limits and Catalina/Big Sur - this is one of the discussions that (in its earlier incarnation) I looked at when I was trying to update the instructions from various earlier attempts/versions for earlier OS X versions:

https://gist.github.com/tombigel/d5...e14b537735d202c

If you scroll down to the comment from iman38 on 15 Nov 2020, it seems to suggest that you can get it to run on Big Sur by doing the following changes to the original limit.maxfiles.plist file:

1) add <string>sudo</string> as a new line before <string>launchctl</string> (so, above line 9)
2) remove <key>ServiceIPC</key><false/> (original lines 17 and 18)

Let me know if that works - if it does I can update the first post to include it as Big Sur specific information.
Back to top