User Tools

Site Tools


misc:macos_notes

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

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:

  1. 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)
  2. 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>

  
  1. 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

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki