I tried setting the Maven PATH in .profile file as well using export commands in terminal(Mac OSX). But, on running mvn commands, getting -bash: mvn: command not found
What did you set up exactly? Did you setup PATH like this (or something equivalent):
If yes, did you logout and login again? According to the bash manpage:
When bash is invoked as an interactive login shell, or as a non-interactive shell with the
--loginoption, it first reads and executes commands from the file
/etc/profile, if that file exists. After reading that file, it looks for
~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The
--noprofileoption may be used when the shell is started to inhibit this behavior.
When an interactive shell that is not a login shell is started, bash reads and executes commands from
~/.bashrc, if these files exist. This may be inhibited by using the
--rcfilefile option will force bash to read and execute commands from file instead of
As you can see, commands from
.profile are not executed for a non-login shell (the type of shells you open after logging in). So you have to logout/login or to source the file manually to take your setup into account. See this blog post for more details.