MacPorts Installation -- Shell Commands/Postflight Script - macos

I had run the MacPorts installer (2.0.3) for my OS X Leopard (10.5.8) which finished "successfully". Unfortunately the port command was not available so I looked in the MacPorts Guide which says that the installer should have run a so-called "postflight" script that sets the necessary environment variables. I tried to run the postflight script manually (which I downloaded from here), but the execution fails with the following output:
Detected the bash shell.
Your shell already has the right PATH environment variable for use with
MacPorts!
Your shell already has the right MANPATH environment variable for use with
MacPorts!
Your shell already has the right DISPLAY environment variable for use with
MacPorts!
Adding [default] tag to sources.conf if needed...
couldn't read file "/Contents/Resources/upgrade_sources_conf_default.tcl": no
such file or directory
Updating port image format...
couldn't read file "/Contents/Resources/images_to_archives.tcl": no such file or
directory
Synchronizing the MacPorts installation with the project's rsync server...
-bash: __PREFIX__/bin/port: No such file or directory
An attempt to synchronize your recent MacPorts installation with the project's
rsync server failed!
Please run 'sudo port -d selfupdate' manually to find out the cause of the
error.
You have succesfully installed the MacPorts system, launch a terminal and try it
out!
Read the port(1) manual page and http://guide.macports.org for help,
http://www.macports.org/contact.php if you need to get in touch with The
MacPorts Project.
Any ideas?

First invoke the port command directly:
$ /opt/local/bin/port help
If that comes back with something reasonable (like the help text) then it's just that your $PATH isn't being used by your current shell. Try logging off and back on again to resolve that in the short term (this will test that your .bashrc file is correctly configured) or you could just modify the PATH environment variable directly (which doesn't test .bashrc):
$ export PATH=$PATH:/opt/local/bin

You downloaded the postflight script but it alone cannot access the accessory scripts in Contents/ because those are located into the install package.
Those missing Tcl scripts are for upgrading from an older install, the log says PATH was already correctly configured but the macports bin directory could have the wrong position in PATH variables, for instance being at the end of PATH.
If you are doing a fresh install you can just only need PATH and MANPATH -you want man pages provided by macports before system's ones- as per [1]
[1] http://guide.macports.org/#installing.shell.postflight

Related

What is the proper way to insert a variable into a file path in BASH?

I am working on my first script and it has been going well aside from one thing. The script is meant to be a simple script to install a software on Ubuntu devices for work. The main problem I am running into is the path the package is downloaded to is /home/(the user)/Linux_Test (custom file I have in github). Since this is suppose to run on multiple machines I am trying to make the user part of the path a variable. Currently I have
# Install the Agent.
sudo dpkg -i "/home/$USERNAME/Linux_Test/'SentinelAgent_linux_v22_1_2_7 (1).deb'"
and the error it is throwing is:
dpkg: error: cannot access archive '/home//Linux_Test/'SentinelAgent_linux_v22_1_2_7 (1).deb'': No such file or directory
I have changed the variable from "USERNAME" to just "USER" but that attempts to run it as root.

I am trying to clean install flutter and even though, This error doesn't go. How can I resolve it?

I wanted to reinstall flutter but I am getting this error, how can I resolve it?
Run the following command to see if there are any dependencies you need to install to complete the setup (for verbose output, add the -v flag):
flutter doctor
You can update your PATH variable for the current session at the command line, as shown in Get the Flutter SDK. You’ll probably want to update this variable permanently, so you can run flutter commands in any terminal session.
The steps for modifying this variable permanently for all terminal sessions are machine-specific. Typically you add a line to a file that is executed whenever you open a new window. For example:
Determine the directory where you placed the Flutter SDK. You need this in Step 3.
Open (or create) the rc file for your shell. Typing echo $SHELL in your Terminal tells you which shell you’re using. If you’re using Bash, edit $HOME/.bash_profile or $HOME/.bashrc. If you’re using Z shell, edit $HOME/.zshrc. If you’re using a different shell, the file path and filename will be different on your machine.
export PATH="$PATH:[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin"

Installing Glassfish, Wildfly using homebrew on Mac OSX

Trying to install Glassfish(Java EE App. Server) and Wildfly App Server using Homebrew .
http://macappstore.org/wildfly-as/
http://macappstore.org/glassfish/
used these above mentioned tutorials .
I got the following errors while trying to run them by typing just "glassfish" & "wildfly-as" respectively.
Output(Error):
-bash: glassfish: command not found
-bash: wildfly-as: command not found
Searched about it and I think it has something to do with $PATH. I don't understand $PATH Variable . Need help.
The issue is that there are two asadmin scripts. One at $GLASSFISH_HOME/bin and one at $GLASSFISH_HOME/glassfish/bin
Here are full instructions to get your domain up
brew update
brew install glassfish
you should see message, add that line to your .bash_profile
==> Caveats
You may want to add the following to your .bash_profile:
export GLASSFISH_HOME=/usr/local/opt/glassfish/libexec
Open a new terminal then, cd $GLASSFISH_HOME/glassfish/bin
./asadmin start-domain --verbose
Browse to http://localhost:8080 for welcome page and http://localhost:4848 for admin console
I actually installed Wildfly-Application Server using homebrew but could not find a way to run it.
https://tomylab.wordpress.com/2016/07/03/how-to-install-wildfly-on-mac/
This tutorial helped me .
And for glassfish, my installation was again successful using homebrew but was not able to run it . I did figure it out when I ran the following commands.
$ cd /usr/local/opt/glassfish/libexec/bin
$ ./asadmin
asadmin> start-domain
You need to understand about the PATH variable. It is an environment variable on Unix-like operating systems, specifying a set of directories in which executable programs are located. In general, each executing process, or user session, has its own PATH setting.
So, you need to add the glassfish home path to your actual path variable.
Now, as per your problem with running the Glassfish server; try this:
export GLASSFISH_HOME=/usr/local/opt/glassfish/libexec/
export PATH=$PATH:$GLASSFISH_HOME/bin
Add it to your bash profile, if you do not want to do this everytime.

Stardog Command not found

I am trying to get to install stardog on mac 10.8.5 using the instructions provided at http://docs.stardog.com/quick-start/.
The export path particular directory has been created and for which echo’ed to make sure that environmental variable is set up. The license key that is provided is also in the correct directory. When I try to run “$ ./stardog-admin server start” the command is not recognized. So I tried to create an export PATH to stardog’s bin, which did not work either.
I have also tried manually adding the path in the following:
- ~/.bash_profile
- ~/.profile
Still no luck, any ideas?
Using zsh I had a similar problem. For some reason, the docs suggest that from the stardog-directory-name directory you can run the command, but it didn't work until you cd into the bin directory. Once there ./stardog-admin server start should run correctly.
It sounds like you simply have something incorrect in your .bash_profile or .profile. If you run either of the stardog scripts from it's bin directory, it will work. If you're getting a command not recognized error, that sounds like bash cannot find the stardog-admin script.

jenkins on Mac, PATH is not set right, no /usr/local/bin

I recently installed Jenkins, using Homebrew. I also installed Mercurial using Homebrew.
I can successfully clone an hg repo just fine - from Terminal. But if I try and do the same thing as part of a job in Jenkins, it fails.
So, in by job, I told Jenkins to run a shell script echo $PATH. Sure enough, the path /usr/local/bin is not there. If I execute the same command from Terminal, it's there.
So, what is the best way to modify PATH so that Jenkins is pulling the same PATH that I'm using, when I echo it from Terminal?
Note, Jenkins is running from the same user account that I'm logged into doing these tests, so I can't fathom why this is happening.
In your launchd .plist file for Jenkins, you can set the PATH environment variable by using the following:
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>(insert your path value here)</string>
</dict>
That should set the PATH to whatever you need.
For some reason, Jenkins doesn't keep /usr/local/bin in the PATH when connecting to a slave.
You can add it to the PATH either by
Adding an environment variable on the Node Configuration, or
Adding a .bashrc file on the user folder with
PATH="/usr/local/bin:${PATH}"
Note: The Mac client must be disconnected and then reconnected via the Jenkins web app after editing ~/.bashrc
I found that even setting the PATH environment variable for the node didn't work for the hombrew Mercurial installation. The path WOULD get set, but only for the script build phase, not for the VCS checkout phase. Here's what I wound up doing.
Go into Manage Jenkins -> Configure System
Add a new Mercurial Installation
Name it whatever you want (I named mine build-mac)
For Installation Directory I put /usr/local
The Executable parameter was pre-set to INSTALLATION/bin/hg, so I just left it at that.
Everything else in here can be left blank
Go into your job and edit the configuration
Under Source Code Management set Mercurial Version to the mercurial installation you just added.
Save
$$$
Hope that helps anyone else running into this same problem, now that we're not allowed (by default anyways) to do anything inside of /usr/bin anymore. Previously I would have just symlinked hg there, but now with the new "System Integrity Protection" "feature", that's no longer as trivial of task, and even more difficult if your Mac slave is headless.
You can set PATH in launchd.conf file. See here for details. Note that man launchctl says that 'commands can be stored in $HOME/.launchd.conf or /etc/launchd.conf to be read at the time launchd starts', so you probably can create '.launchd.conf' in your home directory and use instructions from the link with this file. But as far as I know in launchd.conf file you can't add directory to PATH, you can just rewrite PATH.
You can also see here for the solution using /etc/paths.d directory
There should be no space on either side of = in following PATH modification:
PATH="/usr/local/bin:$PATH"
I added it to my pre-build step on Jenkins installed on macOS.

Resources