Skip to content

Instantly share code, notes, and snippets.

@dmaclach
Created May 13, 2025 16:12
Show Gist options
  • Save dmaclach/d9ed160e0f1d5537cc5f96cc50663780 to your computer and use it in GitHub Desktop.
Save dmaclach/d9ed160e0f1d5537cc5f96cc50663780 to your computer and use it in GitHub Desktop.
Environment variables for controlling/diagnosing the OSX Objective-C runtime.
From MacOS Sequoia (15.5 - 24F74)
dmaclach-mac2:~ dmaclach$ export OBJC_HELP=1
dmaclach-mac2:~ dmaclach$ get
objc[31594]: Objective-C runtime debugging. Set variable=YES to enable.
objc[31594]: OBJC_HELP: describe available environment variables
objc[31594]: OBJC_PRINT_OPTIONS: list which options are set
objc[31594]: OBJC_PRINT_IMAGES: log image and library names as they are loaded
objc[31594]: OBJC_PRINT_LOAD_METHODS: log calls to class and category +load methods
objc[31594]: OBJC_PRINT_INITIALIZE_METHODS: log calls to class +initialize methods
objc[31594]: OBJC_PRINT_RESOLVED_METHODS: log methods created by +resolveClassMethod: and +resolveInstanceMethod:
objc[31594]: OBJC_PRINT_CLASS_SETUP: log progress of class and category setup
objc[31594]: OBJC_PRINT_PROTOCOL_SETUP: log progress of protocol setup
objc[31594]: OBJC_PRINT_IVAR_SETUP: log processing of non-fragile ivars
objc[31594]: OBJC_PRINT_VTABLE_SETUP: log processing of class vtables
objc[31594]: OBJC_PRINT_VTABLE_IMAGES: print vtable images showing overridden methods
objc[31594]: OBJC_PRINT_CACHE_SETUP: log processing of method caches
objc[31594]: OBJC_PRINT_FUTURE_CLASSES: log use of future classes for toll-free bridging
objc[31594]: OBJC_PRINT_PREOPTIMIZATION: log preoptimization courtesy of dyld shared cache
objc[31594]: OBJC_PRINT_CXX_CTORS: log calls to C++ ctors and dtors for instance variables
objc[31594]: OBJC_PRINT_EXCEPTIONS: log exception handling
objc[31594]: OBJC_PRINT_EXCEPTION_THROW: log backtrace of every objc_exception_throw()
objc[31594]: OBJC_PRINT_ALT_HANDLERS: log processing of exception alt handlers
objc[31594]: OBJC_PRINT_REPLACED_METHODS: log methods replaced by category implementations
objc[31594]: OBJC_PRINT_DEPRECATION_WARNINGS: warn about calls to deprecated runtime functions
objc[31594]: OBJC_PRINT_POOL_HIGHWATER: log high-water marks for autorelease pools
objc[31594]: OBJC_PRINT_CUSTOM_CORE: log classes with custom core methods
objc[31594]: OBJC_PRINT_CUSTOM_RR: log classes with custom retain/release methods
objc[31594]: OBJC_PRINT_CUSTOM_AWZ: log classes with custom allocWithZone methods
objc[31594]: OBJC_PRINT_RAW_ISA: log classes that require raw pointer isa fields
objc[31594]: OBJC_DEBUG_UNLOAD: warn about poorly-behaving bundles when unloaded
objc[31594]: OBJC_DEBUG_FRAGILE_SUPERCLASSES: warn about subclasses that may have been broken by subsequent changes to superclasses
objc[31594]: OBJC_DEBUG_NIL_SYNC: warn about @synchronized(nil), which does no synchronization
objc[31594]: OBJC_DEBUG_SYNC_ERRORS: warn when objc_sync_enter or objc_sync_exit return an error
objc[31594]: OBJC_DEBUG_NONFRAGILE_IVARS: capriciously rearrange non-fragile ivars
objc[31594]: OBJC_DEBUG_ALT_HANDLERS: record more info about bad alt handler use
objc[31594]: OBJC_DEBUG_MISSING_POOLS: warn about autorelease with no pool in place, which may be a leak
objc[31594]: OBJC_DEBUG_POOL_ALLOCATION: halt when autorelease pools are popped out of order, and allow heap debuggers to track autorelease pools
objc[31594]: OBJC_DEBUG_DUPLICATE_CLASSES: warn when multiple classes with the same name are present
objc[31594]: OBJC_DEBUG_DONT_CRASH: halt the process by exiting instead of crashing
objc[31594]: OBJC_DEBUG_POOL_DEPTH: log fault when at least a set number of autorelease pages has been allocated
objc[31594]: OBJC_DEBUG_SCRIBBLE_CACHES: scribble the IMPs in freed method caches
objc[31594]: OBJC_DEBUG_SCAN_WEAK_TABLES: scan the weak references table continuously in the background - set OBJC_DEBUG_SCAN_WEAK_TABLES_INTERVAL_NANOSECONDS to set scanning interval (default 1000000)
objc[31594]: OBJC_DEBUG_WEAK_ERRORS: warn about misuse of objc_storeWeak/objc_loadWeak
objc[31594]: OBJC_DISABLE_VTABLES: disable vtable dispatch
objc[31594]: OBJC_DISABLE_PREOPTIMIZATION: disable preoptimization courtesy of dyld shared cache
objc[31594]: OBJC_DISABLE_PREATTACHED_CATEGORIES: disable preattached categories in the dyld shared cache
objc[31594]: OBJC_DISABLE_TAGGED_POINTERS: disable tagged pointer optimization of NSNumber et al.
objc[31594]: OBJC_DISABLE_TAG_OBFUSCATION: disable obfuscation of tagged pointers
objc[31594]: OBJC_DISABLE_NONPOINTER_ISA: disable non-pointer isa fields
objc[31594]: OBJC_DISABLE_INITIALIZE_FORK_SAFETY: disable safety checks for +initialize after fork
objc[31594]: OBJC_DISABLE_FAULTS: disable os faults
objc[31594]: OBJC_DISABLE_PREOPTIMIZED_CACHES: disable preoptimized caches
objc[31594]: OBJC_DISABLE_AUTORELEASE_COALESCING: disable coalescing of autorelease pool pointers
objc[31594]: OBJC_DISABLE_AUTORELEASE_COALESCING_LRU: disable coalescing of autorelease pool pointers using look back N strategy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment