The application which worked perfectly beginning from OSX 10.6 stopped updating itself on Catalina OSX 10.15. Actually update process was very simple. Once a day the application checked if new version was available sending HTTP GET request to Web server. If server responded that new version is available, the application started the update script, the script downloaded installer of new version, created subdirectory in /tmp directory, moved download script in new directory, stopped the application, uninstalled it and installed the new one, deleted downloaded installer. The problem was that curl command which used for installer download failed with error 23 “Failed writing body”:
curl: (23) Failed writing body (0 != 16275)
After googling a bit I found that one of reason why this error may happen was because curl cannot save downloaded file in specified directory. The first I checked the process user and found that both application and update script were started with root permissions. Next I added pwd command in the update script just before the curl to find out where curl saved downloaded file. After the next script run I checked the script log and found that this was top directory “/”. So if process was started as root why it could save file in any place. It looks YES for old OSX versions, but not for Catalina.
I made simple experiment: open terminal windows, run sudo command to get root privileges and tested access to “/” in Catalina:
MacOSxMojave12:/ root# pwd
MacOSCatalina12:/ root# echo “Write” > a.a
-sh: a.a: Read-only file system
MacOSCatalina12:/ root# ls a.a
ls: a.a: No such file or directory
Catalina did not allow me to save file in top “/” directory for root user. I repeated the same experiment on Mojave:
MacOSxMojave13:/ root# pwd
MacOSxMojave13:/ root# echo “Write” > a.a
MacOSxMojave13:/ root# ls a.a
MacOSxMojave13:/ root# cat a.a
On Mojave Mac there was no problem for root user to write into top “/” directory.
After adding into update script cd command for appropriate directory with write permission just before curl the update process started to work on Catalina Mac as well.
By the way the same top directory protection for BigSur and I suspect it will be the same for the next Mac OS X.