diff --git a/Documentation/installation/osx/install.md b/Documentation/installation/osx/install.md index 1f8fdffddfbefe2f22851778a7deffdd1a5cec2f..e9cc987a56779bda413cceba11c1208bafe382e7 100644 --- a/Documentation/installation/osx/install.md +++ b/Documentation/installation/osx/install.md @@ -21,6 +21,6 @@ Only do this if you have a valid reason to use the native backend. 1. Run `xcode-select --install` 2. On macOS 10.14 manually install the legacy include headers by running `/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg` 3. Clone the repo into `$GOPATH/src/github.com/derekparker/delve` -4. Run `make install` in that directory +4. Run `make install` in that directory (on some versions of macOS this requires being root, the first time you run it, to install a new certificate) The makefile will take care of creating and installing a self-signed certificate automatically. diff --git a/scripts/make.go b/scripts/make.go index 9940a7efc0602db08197ed606faa9031f8eb591c..82cff0d9a9ca81581be3a2bde3d0862b0af30b07 100644 --- a/scripts/make.go +++ b/scripts/make.go @@ -105,22 +105,33 @@ This option can only be specified if testset is basic or a single package.`) return RootCommand } -func checkCertCmd(cmd *cobra.Command, args []string) { +func checkCert() bool { // If we're on OSX make sure the proper CERT env var is set. if os.Getenv("TRAVIS") == "true" || runtime.GOOS != "darwin" || os.Getenv("CERT") != "" { - return + return true } x := exec.Command("scripts/gencert.sh") + x.Stdout = os.Stdout + x.Stderr = os.Stderr + x.Env = os.Environ() err := x.Run() if x.ProcessState != nil && !x.ProcessState.Success() { fmt.Printf("An error occurred when generating and installing a new certificate\n") - os.Exit(1) + return false } if err != nil { - log.Fatal(err) + fmt.Printf("An error occoured when generating and installing a new certificate: %v\n", err) + return false } os.Setenv("CERT", "dlv-cert") + return true +} + +func checkCertCmd(cmd *cobra.Command, args []string) { + if !checkCert() { + os.Exit(1) + } } func strflatten(v []interface{}) []string { @@ -214,7 +225,9 @@ func prepareMacnative() string { if !canMacnative() { return "" } - checkCertCmd(nil, nil) + if !checkCert() { + return "" + } return "-tags=macnative" }