title: Command failed with fork/exec permission denied on MacOS?
body: <p>I have a go program that needs to execute another executable program, the program I want to execute from my go code is located in <strong>/Users/myuser/bin/</strong> directory and the full path to it would be <strong>/Users/myuser/bin/prog</strong></p>
  
  <p>The code is:</p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "log"
      "os/exec"
  )
  
  func main() {
  cmd := exec.Command("prog")
  cmd.Dir = "/Users/myuser/bin/"
  out, err := cmd.CombinedOutput()
      if err != nil {
          log.Fatalf("cmd.Run() failed with %s\n", err)
      }
      fmt.Printf("combined out:\n%s\n", string(out))
  }
  </code></pre>
  
  <p>When I run the above code on MacOS Mojave I always get the following error:</p>
  
  <blockquote>
    <p>Command failed with fork/exec /Users/myuser/bin/: permission denied</p>
  </blockquote>
  
  <p>I've seen other answers to similar errors such as <a href="https://stackoverflow.com/questions/14943917/go-fork-exec-permission-denied-error">Go fork/exec permission denied error</a> and <a href="https://stackoverflow.com/questions/35159117/go-build-exec-fork-exec-permission-denied">Go build &amp; exec: fork/exec: permission denied</a> but I'm not sure if that's the case here.</p>
  
  <p>Is it a permissions issue on my machine? or something else can be done from the code?</p>