github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/kbnm/hostmanifest/whitelist_darwin.go (about) 1 //go:build darwin 2 // +build darwin 3 4 package hostmanifest 5 6 import ( 7 "fmt" 8 "os" 9 "path/filepath" 10 11 "github.com/keybase/client/go/chat/attachments" 12 ) 13 14 func wrapWriteErr(err error, hostsPath string) error { 15 // we do this temporarily to get the macOS SDK version to 10.14 16 // see https://github.com/keybase/client/pull/17811 17 attachments.LinkNoop() 18 if !os.IsPermission(err) { 19 return err 20 } 21 dirName := filepath.Dir(hostsPath) 22 // This error is pretty common on macOS because other NativeMessaging apps 23 // tend to change the owner of the directory after they install 24 // themselves. How rude. 25 return fmt.Errorf("%s: Make sure you are the owner of the directory. "+ 26 "You can run:\n "+ 27 " sudo chown -R $(whoami):staff %q", err, dirName) 28 }