misc:macos_notes
Table of Contents
MacOS
Updates
After every update, you probably need to reinstall the MacOS Developer Tools. They contain compilers and such, very important and no code will compile, cmake won't work etc.
To update execute xcode-select –install
in a terminal.
If you are compiling code, make sure to delete all old leftover files in build
folders (*.o
files etc).
Terminal Permission denied & Operation not permitted
- Operation not permitted: give Terminal full disk access: https://osxdaily.com/2018/10/09/fix-operation-not-permitted-terminal-error-macos/
- Permission denied: execute command with
sudo
in front. Be careful.
Get gdb to work
The linux debugger gdb is not working on mac. It will complain about “(please check gdb is codesigned - see taskgated(8))”. Here are the steps to fixing it:
- First, you need to create a certificate under “Keychain accsess →Keys” (I called it gdb-codesign, copied an existing one, and I made a public and a private one, all applications can accsess)
- Then you need to save a file called 'gdb.xml' somewhere, I put mine in
'~./config/
'. The content is as follows:
<?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>com.apple.security.cs.allow-jit</key> <true/> <key>com.apple.security.cs.allow-unsigned-executable-memory</key> <true/> <key>com.apple.security.cs.allow-dyld-environment-variables</key> <true/> <key>com.apple.security.cs.disable-library-validation</key> <true/> <key>com.apple.security.cs.disable-executable-page-protection</key> <true/> <key>com.apple.security.cs.debugger</key> <true/> <key>com.apple.security.get-task-allow</key> <true/> </dict> </plist>
- Then, type the following commands into the terminal:
sudo killall taskgated codesign -fs gdb-codesign "$(which gdb)" echo "set startup-with-shell off" >> ~/.gdbinit codesign --entitlements ~/.config/gdb.xml -fs gdb_codesign /usr/local/bin/gdb
This should fix it.
Stack Overflow posts:
misc/macos_notes.txt · Last modified: 2021/11/23 15:29 by statt