Package macho implements access to and creation of Mach-O object files.
258
stars
560
commits
Go
primary language
Jun 20, 2026
updated
Package macho implements access to and creation of Mach-O object files.
This package goes beyond the Go's debug/macho to:
__OBJC metadata is detected and reported unsupported)$ go get github.com/blacktop/go-macho
package main
import "github.com/blacktop/go-macho"
func main() {
m, err := macho.Open("/path/to/macho")
if err != nil {
panic(err)
}
defer m.Close()
fmt.Println(m.FileTOC.String())
}
This library uses Go's structured logging (log/slog) for diagnostic messages. By default, no logs are emitted. To see library diagnostics (warnings about malformed Mach-O data, etc.), set up an slog handler in your application:
import (
"log/slog"
"os"
)
// Enable debug logging
slog.SetDefault(slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{
Level: slog.LevelWarn, // Or slog.LevelDebug for more verbose output
})))
This allows you to control go-macho's logging output in your application without it polluting stdout by default.
MIT Copyright (c) 2020-2026 blacktop
Go
99.9%
Package macho implements access to and creation of Mach-O object files.
258
stars
560
commits
Go
primary language
Jun 20, 2026
updated
Package macho implements access to and creation of Mach-O object files.
This package goes beyond the Go's debug/macho to:
__OBJC metadata is detected and reported unsupported)$ go get github.com/blacktop/go-macho
package main
import "github.com/blacktop/go-macho"
func main() {
m, err := macho.Open("/path/to/macho")
if err != nil {
panic(err)
}
defer m.Close()
fmt.Println(m.FileTOC.String())
}
This library uses Go's structured logging (log/slog) for diagnostic messages. By default, no logs are emitted. To see library diagnostics (warnings about malformed Mach-O data, etc.), set up an slog handler in your application:
import (
"log/slog"
"os"
)
// Enable debug logging
slog.SetDefault(slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{
Level: slog.LevelWarn, // Or slog.LevelDebug for more verbose output
})))
This allows you to control go-macho's logging output in your application without it polluting stdout by default.
MIT Copyright (c) 2020-2026 blacktop
Go
99.9%