Updating Ant on mac - macos

I am running ant 1.8.2 and I want to up date to the latest on my mac. What is the best way to do this? Should I remove then install or can i write over the previous?
I use it in both Eclipse and from the command line. I also have jenkins call ant targets. It's currently set in /usr/local

I found these two links to update Ant on mac:
Seventy6.com
Ninjascript.com
I had Ant 1.8.4 installed on my Mac 10.8.5 and upgraded to:
Apache Ant(TM) version 1.9.4 compiled on April 29 2014
The first website from seventy6 said all of the below, with a few updates from myself.
To see what version you currently have installed run this:
$ ant -version
Apache Ant version 1.7.1 compiled on February 11 2010
I was advised to use the simple OSX package installer homebrew. I’m not going to discuss how to install this, as they have a really simple guide. However, it’s not obvious how to install Apache Ant as it’s not one of the packages they list. So here is the brew to get started:
$brew install https://raw.github.com/adamv/homebrew-alt/master/duplicates/ant.rb
EDIT: You can also just install now with homebrew just by typing the following
$brew install ant
Beware, you might need to install Apple’s XCode, which if you’re still running OS X 10.6 or lower (like me) you can’t install the latest version (4) via the wonderful (?) AppStore. Ha! fun and games! Luckily, I have an Apple Developer account which allows you to download archived releases of Apple’s software. I created this ages ago and assume they’re still free to do… Once installed it puts the package here:
/usr/local/Cellar/ant/1.8.2
I then scratched my head for a while as to how to get OSX to use the newly installed version. It seems the easiest option is to remove the symlink currently set for the system. Run this to see where this is:
$ whereis ant
/usr/bin/ant //returned message
So we need to remove the symlink and set it to our new installed copy. I found this article which got me started. Useful, but not perfect for a homebrew package install. So here is the final commands to change the symlink to the homebrew version:
$ cd /usr/share
$ sudo rm /usr/share/ant
Password:
************
$ ln -s /usr/local/Cellar/ant/1.8.2 ant
You now need to close your current terminal session and open a new one. In theory you should be able to run 'ant -version' to get the latest version…
$ ant -version
Apache Ant(TM) version 1.8.2 compiled on December 20 2010
I’m not sure if it’s best way to do it. But it’s a simple technique which can easily be updated if needed. At least you haven’t removed the base Java install of Ant from your system!
DONE
Also from blog.ninjascript.com, I saw this was interesting to know about:
Now Ant is kind of buried in OS X; the $PATH variable points to a symlink which points to another symlink. To find out where ant really is, just follow the chain:
$ which ant
/usr/bin/ant
$ ls -la /usr/bin/ant
lrwxr-xr-x 1 root wheel 22 Nov 11 18:04 /usr/bin/ant -> /usr/share/ant/bin/ant
$ ls -la /usr/share/ant
lrwxr-xr-x 1 root wheel 14 Nov 11 18:04 /usr/share/ant -> java/ant-1.7.1
$ ls -la /usr/share/java/ant-1.7.1
total 40
drwxr-xr-x 8 root wheel 272 Feb 27 12:32 .
drwxr-xr-x 8 root wheel 272 Nov 11 18:04 ..
-rw-r--r-- 1 root wheel 15289 Feb 10 2010 LICENSE.txt
-rw-r--r-- 1 root wheel 1270 Feb 10 2010 NOTICE.txt
drwxr-xr-x 8 root wheel 272 Feb 10 2010 bin
drwxr-xr-x 3 root wheel 102 Feb 10 2010 docs
drwxr-xr-x 15 root wheel 510 Feb 10 2010 etc
drwxr-xr-x 44 root wheel 1496 Feb 27 12:09 lib

Related

Mac os permissions prevent me to delete files

I installed easy_install on mac wityh the following command:
curl https://bootstrap.pypa.io/ez_setup.py -o - | sudo python
After that I tried to install pip but couldn't.
After checking here is what I have in /usr/bin
$ ls -l easy*
-rwxr-xr-x 2 root wheel 925 7 Jan 2016 easy_install
-rwxr-xr-x 1 root wheel 454 7 Jan 2016 easy_install-2.6
-rwxr-xr-x 1 root wheel 461 7 Jan 2016 easy_install-2.7
Probably it does not work because I have 2 versions installed now. I am in the list of sudoers but even with sudo I cannot delete these files:
sudo rm -f easy_install-2.6
Password:
rm: easy_install-2.6: Operation not permitted
When I log in to this macbook there is my username and also Administrator which I do not have access to now.
Is there a way to be able to delete these files without having to wait until the person that has the password for Administrator comes back from vacation?
Here is my macbook info
System Version: OS X 10.11.6 (15G31)
Kernel Version: Darwin 15.6.0
Boot Volume: Macintosh HD
Thanks

Using brew to Install GNU flex on OS X but got an error "/usr/local/lib/pkgconfig is not writable."

I need compile some LEX/YACC files(*.l) under OS X. And GNU flex is needed as a scanner.
However, I was stuck while installing GNU flex.
Run brew install flex, but got an error:
Error: You must `brew link xz' before flex can be installed
Then I run brew link xz, still got an error:
Error: Could not symlink lib/pkgconfig/liblzma.pc
/usr/local/lib/pkgconfig is not writable.
How to install flex on OS X 10.10 correctly? Is this problem caused by my home brew?
Some details about my 'brew':
Run brew doctor
Warning: /usr/local/lib/pkgconfig isn't writable.
This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a formula tries to write a file to this directory, the
install will fail during the link step.
You should probably `chown` /usr/local/lib/pkgconfig
Run ls command
yeze#yezedeMacBook-Pro:~$ ls -la /usr/local/lib/pkgconfig
total 16
drwxr-xr-x 4 root wheel 136 Mar 31 2013 .
drwxr-xr-x 30 yeze admin 1020 Oct 1 21:05 ..
-rw-r--r-- 1 root wheel 405 Mar 30 2013 tcl.pc
-rw-r--r-- 1 root wheel 404 Mar 30 2013 tk.pc
This question is caused by brew.
When you got /usr/local/lib/pkgconfig is not writable., you should run:
chown [YourAccountName] /usr/local/lib/pkgconfig
Then follow the instruction, run brew link xz. You may get a response like that :Linking /usr/local/Cellar/xz/5.2.1... 53 symlinks created
Finally, try brew install flex again, it will work.
Best thanks #IKavanagh.

How to install Mono on macOS so mono works in terminal?

I'm trying to get a Mono install running on a mac (OS X version 10.10.5), and while the install states that it's completed successfully, I'm not able to call mono from the terminal.
To install it, I ran uninstallMono.sh as root to ensure we didn't have any leftover cruft, then ran MonoFramework-MDK-4.0.4.1.macos10.xamarin.x86.pkg. The installer appeared to complete successfully, but an attempt to call mono returns
-bash: mono: command not found
The mono framework does appear to be installed:
Lees-Mac-Pro:Downloads kevinmack$ cd /Volumes/Macintosh\ HD/Library/Frameworks/
Lees-Mac-Pro:Frameworks kevinmack$ ls -l
total 32
lrwxr-xr-x 1 root wheel 71 Jan 20 2015 AEProfiling.framework -> ../../Applications/Motion.app/Contents/Frameworks/AEProfiling.framework
lrwxr-xr-x 1 root wheel 74 Jan 20 2015 AERegistration.framework -> ../../Applications/Motion.app/Contents/Frameworks/AERegistration.framework
lrwxr-xr-x 1 root wheel 74 Jan 20 2015 AudioMixEngine.framework -> ../../Applications/Motion.app/Contents/Frameworks/AudioMixEngine.framework
drwxr-xr-x 8 root admin 272 Sep 12 11:24 Mono.framework
lrwxr-xr-x 1 root wheel 60 Sep 9 22:16 NyxAudioAnalysis.framework -> /System/Library/PrivateFrameworks/NyxAudioAnalysis.framework
drwxr-xr-x 5 root wheel 170 Jan 20 2015 PluginManager.framework
drwxr-xr-x 8 root wheel 272 Sep 9 22:19 iTunesLibrary.framework
...but it isn't present in /usr/bin and attempting to find its executable using which mono returns nothing.
In OS X El Capitan, run the following in Terminal to support mono command
export PATH=/Library/Frameworks/Mono.framework/Versions/Current/bin/:${PATH}
Update (since this is still getting views two+ years later):
The latest versions of Mono (5.x) installation process creates a file (mono-commands) in /etc/paths.d that contains the path of:
/Library/Frameworks/Mono.framework/Versions/Current/Commands
So /usr/local/bin is no longer used...
Original
Newer versions of mono comply to the "El Capitan" requirements of not installing anything into /usr/bin and thus now /usr/local/bin is used. I am not sure which mono 4.x release that started in...
But I would assume that you do not have /usr/local/bin in your path(?), try:
export PATH=/usr/local/bin:${PATH}
which mono
which mcs
In my case, I have 4.2.0 installed:
$ which mono
/usr/local/bin/mono
$ which mcs
/usr/local/bin/mcs
$ mono --version
Mono JIT compiler version 4.2.0 (explicit/2701b19 Mon Aug 31 09:57:28 EDT 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
$ cat `which mcs`
#!/bin/sh
export PATH=$PATH:/Library/Frameworks/Mono.framework/Versions/4.2.0/bin
export PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/External/pkgconfig:/Library/Frameworks/Mono.framework/Versions/4.2.0/lib/pkgconfig:/Library/Frameworks/Mono.framework/Versions/4.2.0/share/pkgconfig:$PKG_CONFIG_PATH
exec /Library/Frameworks/Mono.framework/Versions/4.2.0/bin/mono $MONO_OPTIONS /Library/Frameworks/Mono.framework/Versions/4.2.0/lib/mono/4.5/mcs.exe "$#"
It is better to use the next export:
export PATH=$PATH:/Library/Frameworks/Mono.framework/Versions/Current/bin/
You don't modify the previous order of PATH (It's very
important!!)
You will use the current version (when update
the version it isn't necessary to change the variable PATH)
Another option (best option) is to include a new line at the end of the file /etc/paths with the content:
/Library/Frameworks/Mono.framework/Versions/Current/bin
In this case, the path will be available for all users on the system.
After the first installation of Mono Framework using brew cask I found out that brew itself offers Mono (!)
I uninstalled Mono first.
$ brew cask uninstall mono-mdk
And installed it using brew install mono and removed all the configuration changes in ~/.zshrc.
Looks like it's much nicer:
$ type mono
mono is /usr/local/bin/mono
$ mono --version
Mono JIT compiler version 4.6.2 (Stable 4.6.2.7/08fd525 Tue Nov 22 22:05:18 GMT 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: normal
SIGSEGV: altstack
Notification: kqueue
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: sgen
I first used brew cask to install Mono Framework and had to add /Library/Frameworks/Mono.framework/Home/bin to PATH environment variable.
$ brew cask info mono-mdk
mono-mdk: 4.6.2.7
http://www.mono-project.com/
Not installed
From: https://github.com/caskroom/homebrew-cask/blob/master/Casks/mono-mdk.rb
==> Name
Mono
==> Artifacts
MonoFramework-MDK-4.6.2.7.macos10.xamarin.universal.pkg (pkg)
➜ kafunk git:(master) brew cask install mono-mdk
==> Downloading https://download.mono-project.com/archive/4.6.2/macos-10-universal/MonoFramework-MDK-4.6.2.7.macos10.xamarin.universal.pkg
######################################################################## 100,0%
==> Verifying checksum for Cask mono-mdk
==> Running installer for mono-mdk; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
Password:
==> installer: Package name is Mono Framework
==> installer: Installing at base path /
==> installer: The install was successful.
🍺 mono-mdk was successfully installed!
Since I use oh-my-zsh I defined MONO_HOME in ~/.zshrc and adjusted PATH accordingly:
export MONO_HOME=/Library/Frameworks/Mono.framework/Home
export PATH=$MONO_HOME/bin:$PATH
With that mono is available:
$ mono --version
Mono JIT compiler version 4.6.2 (mono-4.6.0-branch/08fd525 Thu Nov 10 20:28:28 EST 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: normal
SIGSEGV: altstack
Notification: kqueue
Architecture: x86
Disabled: none
Misc: softdebug
LLVM: yes(3.6.0svn-mono-master/8b1520c)
GC: sgen
I've been watching this page because I too had problems with installing Mono (for the first time) on El Capitan. I found the framework was installed but the commands were not put into the /usr/local/bin. Symlinking them didn't seem to work because I would get errors when trying to use the mono command and it was looking for libraries in the wrong place.
What I finally found worked (by trial and error) was setting $PATH to the Mono framework using the command in terminal:
export PATH=/Library/Frameworks/Mono.framework/Versions/4.2.0/bin/:${PATH}
Since I'm not a programmer or coder (at least not for a long time and never on OS X), this allowed me to run Duplicati using mono (which was why I wanted it in the first place), but I'm not sure if this is the correct way to solve this or even if this should be done at all. Anyone with actual programming experience to comment or clarify?
El Capitan now protects certain system directories in "rootless" mode (a.k.a. System Integrity Protection). If you run the command ls -lO /System/Library/LaunchDaemons you'll see that the directories and files under there are now marked as "restricted."
You can disable rootless mode like this:
Reboot into recovery mode (reboot and hold down Cmd-R)
Open a terminal
Use this command: csrutil disable
Reboot and run the command that worked prior to El Capitan
Install Mono latest version.
When you're done, it is highly recommended that you re-enable SIP by following the same steps, but using csrutil enable in step 3.
I ran into a problem with the same root cause while trying to get pear/pecl modules and macports/homebrew apps installed. Those typically need to install files into /usr/include and /usr/lib, which are also now restricted.
Note: Previous answers around the Internet about this problem give you instructions for modifying NVRAM settings, but Apple stated that the NVRAM method would stop working with El Capitan's public release. The GM release has already disabled the NVRAM workaround, so this answer should get you what you need moving forward.
open .bash_profile
add export PATH=$PATH:/Library/Frameworks/Mono.framework/Versions/Current/Commands to it
done!
try installing the older version.
3.4.0 is working for me OSX (10.10.5)..
http://origin-download.mono-project.com/archive/3.4.0/macos-10-x86/
Quick Summary:
Atm, the mono framework installer only works correctly if you install it to root. It will automatically add /Library/Frameworks/Mono.framework/Versions/Current/Commands to $PATH, but I don't know if you will need to add /Library/Frameworks/Mono.framework/Versions/Current/bin/ by hand or if everything just works. (Commands is a symbolic link to bin, but it still may not work)
More in-depth:
I recently installed mono from MonoFramework-MDK-4.8.0.520.macos10.xamarin.universal.pkg. I installed it to /Volumes/osxapps/ instead of root, but the installation still expected everything to be in root. It added /Library/Frameworks/Mono.framework/Versions/Current/Commands to $PATH but everything in /Library/Frameworks/Mono.framework/ was just empty directories. All the files resided in /Volumes/osxapps/Library/Frameworks/Mono.framework/.
Furthermore, a lot of what was in /Volumes/osxapps/Library/Frameworks/Mono.framework/ including Commands were not folders but symbolic links that didn't work because they expected the folders to be in root. For example: If everything were installed in root,
/Library/Frameworks/Mono.framework/Versions/Current/Commands is a symlink to /Library/Frameworks/Mono.framework/Versions/Current/bin and /Library/Frameworks/Mono.framework/Versions/Current/ is also a symlink.
I added:
export PATH="/Volumes/osxapps/Library/Frameworks/Mono.framework/Versions/4.8.0/bin:$PATH"
to .bash_profile, in ~/, which allowed me to run the commands/executables, but they all died with errors because they were still expecting things to be in root.
So I copied the folder from /Volumes/osxapps/Library/Frameworks to /Library/Frameworks/ and that solved all the errors and things are working properly but now I have two copies of Mono.framework and I didn't want it installed in root in the first place, because root is on an ssd, and space is limited.
A better solution would be to uninstall mono according to the instructions at bottom of this page and then reinstall on root.
However, it would still be better, for me, to install on /Volumes/osxapps/, but I don't know the best way to go about doing that. (I could probably just recreate a bunch of symbolic links). I was going to tell the mono-project that their installer mucks everything up if you don't install to root, but I'm not sure the best way to go about doing that either. So, instead I have posted here, with what I have learned so far, in the hope that it could help someone else.

Can't run `bzr explorer` on Mac OS 10.9.x

Unfortunately, the answer to this question did not answer my problem. :(
I have the following installed:
$ python
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
$ brew install qt
Warning: qt-4.8.6 already installed
$ brew install pyqt
Warning: pyqt-4.11.1 already installed
$ brew install sip
Warning: sip-4.16.3 already installed
Then when I try to run bzr explorer, it returns the following:
$ bzr explorer
bzr: ERROR: No module named PyQt4
You may need to install this Python library separately.
I am running on Mac OS 10.9.x.
My /Users/me/.bazaar/plugins directory have the following:
$ ll
total 0
drwxr-xr-x 25 me staff 850 Oct 9 15:21 explorer
drwxr-xr-x 20 me staff 680 Oct 9 15:22 qbzr
What am I missing?

How to do alternative install of Homebrew

Ok, well it's just been one of those nights where you spend hours and hours trying to get something to work, and you just keep getting weird errors, so if someone could help me I would greatly appreciate. After hours of trying to update Maven from 3.0.4 to 3.1.1 or 3.2.2 I've decided it's just not going to happen (I've tried almost everything I can find online, but I'm afraid to try to do to much in terminal) and I'm trying to install homebrew to make it easier. When I try to do the normal homebrew install I get an error that says:
dyld: lazy symbol binding failed: Symbol not found: ___strlcpy_chk
Referenced from: /usr/local/git/bin/git
Expected in: /usr/lib/libSystem.B.dylib
dyld: Symbol not found: ___strlcpy_chk
Referenced from: /usr/local/git/bin/git
Expected in: /usr/lib/libSystem.B.dylib
Failed during: git init -q
So then, I tried to do the alternative install method, but at this point I'm just so annoyed, and I don't get what it wants me to do. If anyone could give me some at least kind of detailed explanation for what to do I would be extremely grateful.
Here's where I'm looking at alternative installs: https://github.com/Homebrew/homebrew/wiki/Installation
The problem is I don't even really know what they mean by "untar" and "extract."
Thanks so much to anyone who can help
When I enter
ls -l /usr/local | pbcopy
I get:
total 0
drwxr-xr-x 2 root wheel 68 Aug 11 03:34 apache-maven
drwxrwxr-x 81 root admin 2754 Jan 17 2014 bin
drwxrwxr-x 3 root admin 102 Feb 21 2013 etc
drwxr-xr-x 9 root wheel 306 Jul 25 14:54 git
drwxrwxr-x 3 root admin 102 Feb 21 2013 lib
drwxrwxr-x 4 root admin 136 Feb 20 2013 share
drwxr-xr-x 4 root wheel 136 Dec 14 2013 texlive
Edited
Ok, so let's do an alternative install of homebrew:
cd /usr/local
mkdir homebrew
curl -L https://github.com/Homebrew/homebrew/tarball/master | tar xz --strip 1 -C homebrew
If that works, you just need to find the directory where the file brew is located and then add that to your PATH
So
find /usr/local -name brew
Let's suppose the previous command results in
/usr/local/homebrew/bin/brew
we take brew off the end (because we want to know its directory only) and we add that to the start of our PATH
export PATH=/usr/local/homebrew/bin:$PATH
Now we should be able to run
brew doctor
Also, we need to add that export PATH=.... command to our login sequence so our shell knows how to find brew every time we login. So add that line to the end of your ~/.profile
Original Answer
Ok, take a deep breath, and relax :-)
homebrew is a great choice on the Mac, so the pain should be worth it. I suspect you have a customised PATH and customised environment variables which are stopping the homebrew installation. You can either set your PATH and environment variables back to their default settings, or, if that is simpler, just add a new user to your Mac and log in as the new user with a standard environment and then install homebrew using the standard method.
To look at your PATH and environment variables, use these commands:
echo $PATH
set
or
set | grep -i LIB
to look for any customised DYLD_LIBRARY_PATH
Once you have it installed, try running
brew doctor
to check your setup before adding maven and other packages.

Resources