Mrview error: unknown option

Okay I think it might be fixed. When I open .bash_profile there is only one line:
export PATH=/applications/mrtrix3/bin:/applications/mrtrix3/scripts:/Applications/mrtrix

Also, when I do cat ~/.bash_profile in terminal I get:
export PATH=/applications/mrtrix3/bin:/applications/mrtrix3/scripts:/Applications/mrtrix

Same thing - which I think is a good thing?
But with echo $PATH I get:
/Applications/mrtrix-0.2.12/bin:/applications/mrtrix3/bin:/usr/local/fsl/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin

Is this where the set_path comes in? Should it say “export” in my bash_profile?

Last thing, when I try to do set_path from instructions I still get the error:
ERROR: MRtrix3 executables not found in expected location.

This script needs to be run from within the MRtrix3 toplevel directory, AND
after the build script has successfully completed. In addition, the set_path
script should NOT be moved from its original location in the MRtrix3 toplevel
directory.

Thanks for the help!

OK, there’s quite a few things that look a bit unusual here:

  • as Max says, there’s something odd with the path, in that some parts mention /applications, others /Applications. This is case-sensitive on MacOSX, one of these is wrong.

  • the last bit of the path that is being set in your ~/.bash_profile is redundant: you don’t need that last /Applications/mrtrix in there.

  • regardless, it looks like this file is being ignored. The path you get in the shell (with echo $PATH) clearly doesn’t include the bits you’d set in the ~/.bash_profile. Maybe this isn’t the right file to use… I’m pretty sure that set_path would get this right, we did a bit of testing to confirm at the time.

  • you have the set_path script in the installation, yet the executables seems to be in bin/ rather than release/bin. This can only make sense if you updated the code (git pull) without actually compiling it (./build). So I wonder if you think you have up to date code, because it doesn’t look like your actual executables haven’t been updated.

  • I assume that the /Applications folder is a system folder, which would require administrator privileges to make any modifications. This might prove tricky or at least annoying in the long run. I’d typically recommend installing within your own folder, or using @maxpietsch’s new homebrew recipe.

So given all of these slightly odd issues, I think the safest thing to do here is a full clear out and update to the latest version - assuming you don’t need stick to the old one. I assume the simplest thing would be just remove the /Applications/mrtrix3 folder, and then follow the instructions for installation on MacOSX. Maybe @maxpietsch can comment on this, but your current installation just doesn’t seem quite right to me…

I hate to throw something else into the mix but now that the ~/.bash_profile is changed when I open a new terminal window it says bash command not found. Any idea what went wrong or how I did this?

Once I fix this I will re-install mrtrix3 like you suggest!

Phew,

Let’s fix your bash_profile:

don’t panic. :slight_smile:

  1. execute:
    /bin/mv ~/.bash_profile ~/.bash_profile_bak

  2. open a new terminal and execute:
    ls
    you should get a list of files but not the bash command not found error. Otherwise, execute the following (one line, make sure to copy all of it):

/bin/mv ~/.bash_history ~/.bash_history_bak; for f in ~/.bash*; do /bin/echo "$f"; ls -la "$f"; /bin/cat "$f"; echo "----"; done | /usr/bin/tee fixme.txt; /bin/mv ~/.bash_history_bak ~/.bash_history

and upload the file fixme.txt which is in your user directory here or send it to me: maximilian.pietsch@kcl.ac.uk.

fix mrtrix3 if the above worked

I agree with @jdtournier :

@jdtournier /Applications can be modified with user priviliges.

update mrtrix3:

Given the

I think mrtrix3 is installed in /applications/mrtrix3.

I would delete that folder and follow the instructions for installation on MacOSX. The easiest way of installing mrtrix3 is via homebrew (see this Note).

only if you have reasons not to update your version of mrtrix3:

execute (in a new terminal and make sure to copy the full line):

echo "export PATH=/applications/mrtrix3/bin:/applications/mrtrix3/scripts:/usr/local/fsl/bin:\$PATH" > ~/.bash_profile

open another new terminal and execute:

which mrview

if this points to the old version, post the output of
echo $PATH

Hi Max,

Here is the output from the last command you had me do:

yoda:~ jacquiehodge$ brew install mrtrix3 -verbose
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin15/rbconfig.rb:213: warning: Insecure world writable dir /opt/X11/bin in PATH, mode 040777
==> Installing mrtrix3 from mrtrix3/mrtrix3
==> Cloning https://github.com/MRtrix3/mrtrix3.git
Updating /Users/jacquiehodge/Library/Caches/Homebrew/mrtrix3--git
git config remote.origin.url https://github.com/MRtrix3/mrtrix3.git
git config remote.origin.fetch +refs/heads/master:refs/remotes/origin/master
git fetch origin
==> Checking out branch master
git checkout -f master --
Already on 'master'
Your branch is up-to-date with 'origin/master'.
git reset --hard origin/master
HEAD is now at 7d55993 Merge pull request #812 from MRtrix3/fix_average_response
git submodule foreach --recursive git submodule sync
Entering 'testing/data'
git submodule update --init --recursive
==> mkdir /usr/local/Cellar/mrtrix3/0.3.15-315-g18462ac/lib
==> mkdir /usr/local/Cellar/mrtrix3/0.3.15-315-g18462ac/release
==> ln -s /usr/local/Cellar/mrtrix3/0.3.15-315-g18462ac/bin /usr/local/Cellar/mrtrix3/0.3.15-315-g18462ac/release/bin
==> mkdir /usr/local/Cellar/mrtrix3/0.3.15-315-g18462ac/matlab
==> python matlab_add.py
added mrtrix path to /Applications/MATLAB_R2010b.app/toolbox/local/startup.m
added mrtrix path to /Applications/MATLAB_R2014a.app/toolbox/local/startup.m
added mrtrix path to /Applications/MATLAB_R2015b.app/toolbox/local/startup.m
==> mkdir /usr/local/Cellar/mrtrix3/0.3.15-315-g18462ac/icons
==> git log -1
commit 7d559932f617aac078ad05d1ff2a4595e27a5723
Author: maxpietsch <maxpietsch@users.noreply.github.com>
Date:   Fri Nov 4 11:43:42 2016 +0000

    Merge pull request #812 from MRtrix3/fix_average_response
    
    average_response is now python 2 and 3 compatible

MRtrix build type requested: release

Detecting OS: darwin
OS X deployment target: 10.11
Checking for C++11 compliant compiler [clang++]: 4.2.1 - tested ok
Detecting pointer size: 
ERROR: unable to determine pointer size!

  See the file 'configure.log' for details. If this doesn't help and you need
  further assistance, please post on the MRtrix3 community forum
  (http://community.mrtrix.org/), and make sure to include the full contents of
  the 'configure.log' file.

no configuration file found for target build "release"!
please run "./configure" prior to invoking this script

Warning: tried to install empty array to /usr/local/Cellar/mrtrix3/0.3.15-315-g18462ac/bin
Error: unknown file type: release/lib/.

Thanks!

Not sure what is causing this. @jdtournier Any idea?

I see that every now and again on Windows; usually immediately re-running configure proceeds as normal. :hushed:

That is really weird… The fact that this line of the configure script completes OK:

Checking for C++11 compliant compiler [clang++]: 4.2.1 - tested ok

Means that the script was able to compile and run:

struct Base {                                                                                                                                                                                                                                 
    Base (int);                                                                                                                                                                                                                               
};                                                                                                                                                                                                                                            
struct Derived : Base {                                                                                                                                                                                                                       
    using Base::Base;                                                                                                                                                                                                                         
};                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                              
int main() {                                                                                                                                                                                                                                  
  Derived D (int); // check for contructor inheritance                                                                                                                                                                                        
  return (0);                                                                                                                                                                                                                                 
}                                                                                                                                                                                                                                             

But fails on the next test, which involves compiling and running the following with exactly the same settings:

#include <iostream>
int main() {
  std::cout << sizeof(void*);
  return (0);
}

I really can’t see why that would fail…

@Jhodge, does running it again magically work as suggested by @rsmith? If it does, I’ll have to put it down to one of these funny quirks that we’ll never get to the bottom of because we can’t reproduce the problem. If it’s consistently failing, then it’ll need some investigation…

As far as I can tell, the only difference between this test and the one before it (assuming the compiler works OK) is the casting of the return string to int(), and the only reason I can realistically think of as to why that might fail is some issue with the text encoding, which can get particularly thorny and often causes problems that I simply haven’t ever managed to understand. There are also differences in how Python v3 handles bytes vs strings, which can equally cause trouble.

So assuming running it again doesn’t fix it, and assuming this is running on an up to date MacOSX system (Yosemite, El Capitan, or Sierra), all I can suggest is to figure out whether any older versions of Python are installed on the system, e.g. by running this in the same terminal as you’re about to run the MRtrix3 install:

python --version

Anything older than v2.6 will definitely fail. As far as I know, only v2.7 onwards get tested with any regularity.

If that’s not the issue, then you could maybe looking into what character encoding your system is set to. What does the output of this look like:

locale

We reran .configure once already. This should force homebrew to use its version of Python.

@Jhodge:

brew update
brew uninstall mrtrix3
brew install mrtrix3

If this does not work, here is a very long shot:

Execute each line after the other and stop if any gives an error:

brew update
brew uninstall python
sudo xcode-select --install
brew reinstall python  
brew link python  
brew install mrtrix3

@maxpietsch Hey Max before I continue with
brew update
brew uninstall python
sudo xcode-select --install
brew reinstall python
brew link python
brew install mrtrix3

Let me first tell you that when I run “brew uninstall mrtrix3” I get the following error:
Error: No such keg: /usr/local/Cellar/mrtrix3

That’s fine, just try:
brew install mrtrix3
then.

Back to this error:
yoda:~ jacquiehodge$ brew install mrtrix3
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin15/rbconfig.rb:213: warning: Insecure world writable dir /opt/X11/bin in PATH, mode 040777
==> Installing mrtrix3 from mrtrix3/mrtrix3
mrtrix3: Homebrew was unable to find an installation of Qt 5. You can install it for instance via homebrew:

brew update
brew install qt5

Error: An unsatisfied requirement failed this build.

Shall I go ahead with
brew update
brew uninstall python
sudo xcode-select --install
brew reinstall python
brew link python
brew install mrtrix3

?

I get this error:
bash-3.2$ brew reinstall python
==> Reinstalling python
==> Installing dependencies for python: readline, sqlite, gdbm, openssl
==> Installing python dependency: readline
==> Downloading https://homebrew.bintray.com/bottles/readline-7.0.el_capitan.bot
######################################################################## 100.0%
==> Pouring readline-7.0.el_capitan.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you’ll need to add to your
build variables:

LDFLAGS:  -L/usr/local/opt/readline/lib
CPPFLAGS: -I/usr/local/opt/readline/include

==> Summary
:beer: /usr/local/Cellar/readline/7.0: 45 files, 2M
==> Installing python dependency: sqlite
==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.15.1.el_capitan.bo
######################################################################## 100.0%
==> Pouring sqlite-3.15.1.el_capitan.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

macOS provides an older sqlite3.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you’ll need to add to your
build variables:

LDFLAGS:  -L/usr/local/opt/sqlite/lib
CPPFLAGS: -I/usr/local/opt/sqlite/include
PKG_CONFIG_PATH: /usr/local/opt/sqlite/lib/pkgconfig

==> Summary
:beer: /usr/local/Cellar/sqlite/3.15.1: 11 files, 2.9M
==> Installing python dependency: gdbm
==> Downloading https://homebrew.bintray.com/bottles/gdbm-1.12.el_capitan.bottle
######################################################################## 100.0%
==> Pouring gdbm-1.12.el_capitan.bottle.tar.gz
Error: The brew link step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/gdbm_dump
Target /usr/local/bin/gdbm_dump
is a symlink belonging to gdbm. You can unlink it:
brew unlink gdbm

To force the link and overwrite all conflicting files:
brew link --overwrite gdbm

To list all files that would be deleted:
brew link --overwrite --dry-run gdbm

Possible conflicting files are:
/usr/local/bin/gdbm_dump → /usr/local/Cellar/gdbm/1.11/bin/gdbm_dump
/usr/local/bin/gdbm_load → /usr/local/Cellar/gdbm/1.11/bin/gdbm_load
/usr/local/bin/gdbmtool → /usr/local/Cellar/gdbm/1.11/bin/gdbmtool
/usr/local/include/gdbm.h → /usr/local/Cellar/gdbm/1.11/include/gdbm.h
/usr/local/share/info/gdbm.info → /usr/local/Cellar/gdbm/1.11/share/info/gdbm.info
/usr/local/share/man/man1/gdbm_dump.1 → /usr/local/Cellar/gdbm/1.11/share/man/man1/gdbm_dump.1
/usr/local/share/man/man1/gdbm_load.1 → /usr/local/Cellar/gdbm/1.11/share/man/man1/gdbm_load.1
/usr/local/share/man/man1/gdbmtool.1 → /usr/local/Cellar/gdbm/1.11/share/man/man1/gdbmtool.1
/usr/local/share/man/man3/gdbm.3 → /usr/local/Cellar/gdbm/1.11/share/man/man3/gdbm.3
/usr/local/lib/libgdbm.4.dylib → /usr/local/Cellar/gdbm/1.11/lib/libgdbm.4.dylib
/usr/local/lib/libgdbm.a → /usr/local/Cellar/gdbm/1.11/lib/libgdbm.a
/usr/local/lib/libgdbm.dylib → /usr/local/Cellar/gdbm/1.11/lib/libgdbm.dylib
==> Summary
:beer: /usr/local/Cellar/gdbm/1.12: 18 files, 490.8K
==> Installing python dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2j.el_capitan.b
######################################################################## 100.0%
==> Pouring openssl-1.0.2j.el_capitan.bottle.tar.gz
Error: Permission denied - /usr/local/etc/openssl/misc/c_hash
Warning: Bottle installation failed: building from source.
==> Installing dependencies for openssl: makedepend
==> Installing openssl dependency: makedepend
==> Downloading https://homebrew.bintray.com/bottles/makedepend-1.0.5.el_capitan
######################################################################## 100.0%
==> Pouring makedepend-1.0.5.el_capitan.bottle.1.tar.gz
:beer: /usr/local/Cellar/makedepend/1.0.5: 7 files, 72.7K
==> Using the sandbox
==> Downloading https://www.openssl.org/source/openssl-1.0.2j.tar.gz
######################################################################## 100.0%
==> perl ./Configure --prefix=/usr/local/Cellar/openssl/1.0.2j --openssldir=/usr
==> make depend
==> make
==> make test
==> make install MANDIR=/usr/local/Cellar/openssl/1.0.2j/share/man MANSUFFIX=ssl
Last 15 lines from /Users/jacquiehodge/Library/Logs/Homebrew/openssl/05.make:
DSO_WIN32) sfx=“eay32.dll”; pfx=;;
*) sfx=“.bad”;;
esac;
cp ${pfx}gost$sfx /usr/local/Cellar/openssl/1.0.2j/lib/engines/${pfx}gost$sfx.new;
fi;
chmod 555 /usr/local/Cellar/openssl/1.0.2j/lib/engines/${pfx}gost$sfx.new;
mv -f /usr/local/Cellar/openssl/1.0.2j/lib/engines/${pfx}gost$sfx.new /usr/local/Cellar/openssl/1.0.2j/lib/engines/${pfx}gost$sfx;
fi
installing gost
making install in apps…
installing openssl
installing CA.sh
cp: /usr/local/etc/openssl/misc/CA.sh.new: Permission denied
make[1]: *** [install] Error 1
make: *** [install_sw] Error 1

READ THIS: https://git.io/brew-troubleshooting

These open issues may also help:
OpenSSL@1.1 Migration [Tracking] OpenSSL@1.1 Migration [Tracking] · Issue #4543 · Homebrew/homebrew-core · GitHub
ansible: migrate to openssl@1.1 ansible: migrate to openssl@1.1 by tdsmith · Pull Request #4539 · Homebrew/homebrew-core · GitHub
The description for openssl installation is misleading The description for openssl installation is misleading · Issue #5291 · Homebrew/homebrew-core · GitHub
curl: migrate to openssl@1.1 curl: migrate to openssl@1.1 by JLHwung · Pull Request #4591 · Homebrew/homebrew-core · GitHub

Error: Your Xcode (6.1.1) is outdated.
Please update to Xcode 8.1 (or delete it).
Xcode can be updated from the App Store.

I am updating Xcode at the moment

I believe I’ve fixed it. I followed these last instructions from you but also had to do:

then

sudo xcode-select --install



then

I got some warnings from this but no errors.
then in order to actually open the gui using command mrview I had to

Mrtrix3 now opens and is functional!! YAY! And the couple of updated commands and scripts I’ve tested also work!

THANK YOU SO MUCH for all your help guys :slight_smile: