# 5ttgen error on MAC

**URL:** <https://community.mrtrix.org/t/5ttgen-error-on-mac/540>\
**Category:** Uncategorized\
**Created:** [October 26, 2016, 5:21pm UTC](https://community.mrtrix.org/t/5ttgen-error-on-mac/540 "2016-10-26T17:21:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kamal](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/k/a698b9/32.png) [@kamal](https://community.mrtrix.org/u/kamal)\
**Post date:** [October 26, 2016, 5:21pm UTC](https://community.mrtrix.org/t/5ttgen-error-on-mac/540/1 "2016-10-26T17:21:27Z")

</div>

Hi All,

If I type 5ttgen on my mac terminal, I get the following error:

```auto
Traceback (most recent call last):
  File "/usr/local/bin/5ttgen", line 26, in <module>
    algorithm_list = getAlgorithmList()
  File "/usr/local/Cellar/mrtrix3/0.3.15-305-g5e6eef5/scripts/lib/getAlgorithmList.py", line 8, in getAlgorithmList
    src_file_list = os.listdir(os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), 'src', path))
OSError: [Errno 2] No such file or directory: '/usr/local/bin/src/_5ttgen'

```

I installed MRtrix3 fresh using homebrew with all recommended steps. Does anybody have an idea of what is wrong here?

Many thanks,  
Kamal

---

<div class="post-metadata">

**Author:** ![rsmith](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rsmith/32/2672_2.png) [@rsmith](https://community.mrtrix.org/u/rsmith)\
**Post date:** [October 26, 2016, 10:42pm UTC](https://community.mrtrix.org/t/5ttgen-error-on-mac/540/2 "2016-10-26T22:42:31Z")

</div>

OK, this looks like the same symptom as was recently reported [here](https://community.mrtrix.org/t/estimating-response-function-dwi2response-error/530), so it’s probably _not_ manual moving of the script files…

@dchristiaens: Is the homebrew installation grabbing the script files and placing them in `/usr/local/bin/`? This won’t work for `5ttgen` and `dwi2response`, we’ll need to figure out a more appropriate way of installing / arranging / detecting these.

@kamal: A quick fix would be to grab the [`scripts/src/` directory](https://github.com/MRtrix3/mrtrix3/tree/master/scripts/src), and place a copy in your `/usr/local/bin/` directory (so the path that the error is complaining about - `/usr/local/bin/src/_5ttgen` - exists). That should allow `5ttgen` to find the files it’s expecting to see based on a _relative path_ from its own location.

Cheers  
Rob

---

<div class="post-metadata">

**Author:** ![maxpietsch](https://community.mrtrix.org/user_avatar/community.mrtrix.org/maxpietsch/32/25_2.png) [@maxpietsch](https://community.mrtrix.org/u/maxpietsch)\
**Post date:** [October 27, 2016, 11:15am UTC](https://community.mrtrix.org/t/5ttgen-error-on-mac/540/3 "2016-10-27T11:15:18Z")

</div>

@rsmith I don’t copy the scripts but homebrew forces me to symlink the scripts from the mrtrix installation directory in homebrew’s Cellar to /usr/local/bin.

So I [changed](https://github.com/MRtrix3/mrtrix3/pull/801) 5ttgen’s algorithm parsing to dereference symbolic links. This might not work on [windows](http://bugs.python.org/issue9949) but is fine since we don’t symlink there. I couldn’t see any other places where the usage `sys.argv[0]` might cause problems.

@kamal You should get the update with  
`brew upgrade mrtrix3 -force # get a cup of tea`

---

<div class="post-metadata">

**Author:** ![rsmith](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rsmith/32/2672_2.png) [@rsmith](https://community.mrtrix.org/u/rsmith)\
**Post date:** [October 27, 2016, 10:37pm UTC](https://community.mrtrix.org/t/5ttgen-error-on-mac/540/4 "2016-10-27T22:37:51Z")

</div>

👍

@ssargolzaei This should be the fix for the first of your reported issues also.

---

<div class="post-metadata">

**Author:** ![ssargolzaei](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/s/f07891/32.png) [@ssargolzaei](https://community.mrtrix.org/u/ssargolzaei)\
**Post date:** [October 27, 2016, 10:43pm UTC](https://community.mrtrix.org/t/5ttgen-error-on-mac/540/5 "2016-10-27T22:43:57Z")

</div>

@rsmith That’s right. Liked the “cup of tea!” idea and not “cup of coffee” 🙂
