How to run gprolog on macOS Sierra - macos

I have just installed gnu-prolog using brew install gnu-prolog. When I try to run gprolog in the terminal I get gprolog: command not found. I tried doing the same to my other machine that is running ElCapitan and all worked perfectly.
Is there a way for me to get gprologto work for macOS Sierra?

Sounds like an issue with your Homebrew installation. But you can also install GNU Prolog using MacPorts or by downloading its Mac OS X installer from its website.

For the ones using MacPorts - you may download an installation package of gnu prolog directly from its site. It used to solve older installations issues and I have found it to solve the current one as well
use the link
http://www.gprolog.org/gprolog-1.4.4.pkg.zip
best
yehuda

On a Mac, the standard GNU Prolog installation package puts Prolog in the /opt/local/bin directory, which isn't normally in your path.
After installing the GNU Prolog package, open Terminal and type this command:
open -t ~/.bashrc
At the bottom of that file add this line:
export PATH="/opt/local/bin:$PATH"
then save & close the editor. Then type this command:
source ~/.bashrc
This reloads all the commands in the .bashrc file into your current Terminal session. The next time you open Terminal you won't have to do that.
Now you should be able to start GNU Prolog by typing this command:
gprolog
The output should look like this:
GNU Prolog 1.5.0 (64 bits)
Compiled Jul 8 2021, 23:55:41 with /usr/bin/clang
Copyright (C) 1999-2021 Daniel Diaz
| ?-

Related

Terminal shows wrong version of Python after fresh installation on M1 Mac

I downloaded Python 3.9.7 universal2 installer and installed Python on my M1-chip MacBook. Note that this was the first Python installation on this machine except for Apple-provided Python 2.7.16.
Then after running python3 --version line in the Terminal I've got this output xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools. and a pop-up window was opened suggesting installing necessary software. I installed it.
After that I ran python3 --version line again and got this output: Python 3.8.2. The expected output is Python 3.9.7.
What happened? Did I do anything wrong? How to fix it?
It turns out that at least for M1 Macs Apple provides two versions of Python: 2.7.16 and 3.8.2 by default. The commands python --version and python3 --version correspond to them as they appear. The command needed to be used is python3.9 --version which outputs Python 3.9.7 as expected.

Installing gnu plot for macOS High Sierra

How does one install a runnable version of gnu plot in macOS high Sierra?
I am looking for a way to make this work with the GUI, but even just getting the terminal script to run would be a success.
Thanks!
The Brew implementation of gnuplot is not really usable because it no longer supports the necessary terminals (e.g., you can no longer provide --with-aquaterm or --with-x11 during installation).
However, the MacPorts package manager has a usable install for gnuplot (it's safe to have both Brew and MacPorts installed). https://www.macports.org/
After intalling AquaTerm, I used the following to install gnuplot, and all is working as expected:
sudo port install gnuplot +aquaterm
I'm using macOS Mojave 10.14.4.
It's easy enough with homebrew.
First, install Xcode command line tools:
xcode-select --install
Then install homebrew by going to homebrew website and copying and pasting the one-liner installation script. I don't want to paste that line here in case it changes down the line, so get the latest from the homebrew website.
Now you have a full package manager that allows you to find, install, update and delete thousands of packages. So you can easily find gnuplot or anything else with:
brew search gnuplot
Once you have found your package, check the avaiable options with:
brew options gnuplot
Sample Output
--with-aquaterm
Build with AquaTerm support
--with-cairo
Build the Cairo based terminals
--with-qt
Build with qt support
--with-wxmac
Build wxmac support. Need with-cairo to build wxt terminal
--with-x11
Build with x11 support
Now install with some sensible options for graphical plots:
brew install gnuplot --with-qt --with-x11
Always ensure your PATH starts with /usr/local/bin for homebrew since that is where it installs programs. I put the following in $HOME/.profile. And I also set the GNUTERM environment variable:
export PATH=/usr/local/bin:$PATH
export GNUTERM=qt
Now run gnuplot:
gnuplot
Sample Run
Check out many useful packages, a nice new Python not Apple's old v2.7, a nice Linux-compatible sed not Apple's BSD version, a nice grep, a nice find, the brilliant GNU awk, ImageMagick, tmux, GNU Parallel, jhead, Poppler, exiftool, Mosquitto, pdfgrep, pngcrush, ZeroMQ... the list goes on...
#David Atri: gnuplot is not as standalone as you might think. Try to compile it from source and you will see how many options and dependencies it has.The main challenge in MacOSX is to get the PDF drivers running. The fact that you see many things as standalone is the good integration work made by the developers
brew is no longer support options.
You can still do "brew install gnuplot", but it will install with just the terminals that the person who wrote the homebrew formula wanted, not necessarily the ones you want.
Compiling gnuplot from the sources is still a nightmare, so you live with the brew-formula writer's choices, write your own brew formula (not completely trivial), or you struggle with huge pile of dependencies and try to compile from the sources.

Apple's vim always used instead of homebrew

I'm seeing something very odd, and honestly I'm stumped.
The version of vim that comes with mac is outdated (7.3 instead of 7.4). I'm trying to install vim from homebrew, and I want to use that one instead of the default apple version.
I ran "brew install vim". It installed correctly in /usr/local/bin/vim. All good.
When I run "which vim", it prints "/usr/local/bin/vim". The Apple version of vim is installed at /usr/bin/vim. So the which command is telling me that I'm using the homebrew version of vim.
However, when I actually run vim, it still runs the Apple version
$ vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jul 9 2015 23:58:42)
Compiled by root#apple.com
...
If I run the homebrew version explicitly, I see this:
$ /usr/local/bin/vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Oct 23 2015 18:16:35)
MacOS X (unix) version
Included patches: 1-898
Compiled by Homebrew
...
I even tried moving /usr/bin/vim to /usr/bin/vim73 to try to force using the homebrew version. However, when I did this, here is what I see when I try to run vim:
$ vim --version
-bash: /usr/bin/vim: No such file or directory
$
What is going on? How can I get it to run the homebrew version of vim?
Start a new shell session and it’ll work.
Bash caches executables’ paths so when you run vim it looks at your PATH to find the first executable with this name. It caches it and the second time you run vim it remembers vim is actually /usr/bin/vim and runs that.
Since you haven’t restarted your Bash session its cache is still the same; hence the error you’re seeing. It has nothing to do with the way you installed vim.
If you don’t want to start a new shell session, you can run hash -r to tell Bash to clear its executables memory.
You forgot an argument:
$ brew install vim --override-system-vi

Incorrect check of SIP version during PyQt installation

I have been trying to install PyQt on my mac (OSX 10.6.8), but I still having this problem:
When I try to install PyQt-mac-gpl-4.9.6, I get this
Error: This version of PyQt requires SIP v4.14.2 or later.
The weird thing is that when I want to check for sip version on the console and write
sip -V
,I get the correct version: 4.14.2
I have checked my PATH but non of the online tips that I have found have helped me. How do I fix this?
I would recommend checking to see if you have sip installed in different locations, with the newer version being in a path that is not at the head of your PATH.
mdfind -name sip | grep '/bin/'
This should tell you all of the sip binaries on your computer. Check the version of all of them, and then make sure that path is at the front of PATH
What it could actually be, regardless of it seeming like you only have one sip, is a leftover .pyc file that is getting picked up before your intended sip. Try this to confirm:
$ python
>>> import sipconfig
>>> print sipconfig
This will tell you where it is finding sipconfig. If it looks like the wrong spot, or if you check it and all that is left is the pyc file, remove it. Then your newer sip should be found properly.
I had a similar issue after installing sip 4.14.2 over a previous version of 4.13.1 on Mac OSX 10.7.4 and Python 2.7. Strangely, the version of sip from the command line was different from the version from the Python sipconfig module.
$ sip -V
4.14.2
$ python -c "import sipconfig; print sipconfig.version_to_string(sipconfig.Configuration().sip_version)"
4.13.1
I ran through the install again, this time with running the install step as 'sudo make install' and the two versions matched at 4.14.2 and the PyQt instal was successful.
$ cd ~/Downloads/sip-4.14.2/
$ python configure.py
$ make
$ sudo make install

upgrading console emacs (/usr/bin/emacs) on Mac

I extensively use /usr/bin/emacs in Terminal.
I have Emacs 22 and I'd like to upgrade it to 23. I wonder how to do it.
Googling "emacs download mac" gives me Emacs.app which has its own window and user interface, but I don't want that.
I am not sure how I have /usr/bin/emacs in the first place, maybe it came with Mac OS?
You can run the Emacs.app version in a terminal like this:
/Applications/Emacs.app/Contents/MacOS/Emacs -nw
In my .cshrc file, I use an alias to make this easier to invoke:
alias enw '/Applications/Emacs.app/Contents/MacOS/Emacs -nw'
It is a standard editor included with OS X and a lot of other *nix systems along with vi/vim, and pico. Personally i wouldnt upgrade the pre-installed one. I would install from Macports, Fink, or Homebrew or compile from source myself to a different location (like /usr/local).
Install emacs from macports.
% sudo port install emacs
Then launch it from the terminal
Or you can install Emacs.app, follow the instructions here to create a ~/bin/emacs script and then launch as emacs -nw or any other options.
#!/bin/sh
exec /Applications/Emacs.app/Contents/MacOS/Emacs "$#"
I was on this same search and ended up installing with Homebrew so I could get the latest version along with several libraries, as described in this answer at the Emacs Stack Exchange site:
Nowadays, I use just GNU Emacs snapshot builds. These have reasonably good OS X support, and are by far the easiest to install, and best supported by the community.
I used to get them from Emacs for Mac OS X, but now I use Homebrew, because it supports more libraries, notably GNU TLS for encrypted network connections.
All in all: Use brew install emacs --HEAD --use-git-head --with-cocoa --with-gnutls --with-rsvg --with-imagemagick :).
(Note that GNU Emacs is what comes preinstalled on Mac OS X, at least on mine as of 10.10.5)
This added a new Emacs binary at /usr/local/bin/emacs, leaving the existing installation and /usr/bin/emacs in place.
I created a symlink in /usr/local/bin pointing to the new version of emacs which was in Applications/Emacs.app/Contents/MacOS/
For those who installed Emacs from source (or any other way that doesn't overwrite command line called emacs) and want to use this version in the command line, I suggest one of these two approaches:
ln -s ~/path/to/cloned/emacs/src/emacs /usr/local/bin/emacs
make sure /usr/local/bin is in your $PATH and located before /usr/bin, by executing echo $PATH
if it is not, add line export $PATH=/usr/local/bin:$PATH to the file ~/.bash_profile, then refresh $PATH by executing in the terminal source ~/.bash_profile
add ~/path/to/cloned/emacs/src to your $PATH.
for example, add line export $PATH=~/path/to/cloned/emacs/src:$PATH to the file ~/.bash_profile, then refresh $PATH by executing in the terminal source ~/.bash_profile
And yes, MacOS is shipped with many packages pre-installed. But, unfortunately, usually with outdated ones and no official package manager to easily upgrade those libraries. That's actually why we have Homebrew, Macports, maybe others: they serve us as MacOS package managers.

Resources