Download different version of grep in cygwin? - macos

I'd like to download a different version of grep in Cygwin. Currently, I have version 2.21, but I'd like to get version 2.5.1 (this is what runs on Mac OS by default, and I'm more familiar with that).
I obviously don't want to run the entire setup again. Is there a way to get the Mac OS version (i.e. 2.5.1) without running setup all over again? Thanks. <3

Compiling is always a possible choice: grep lives here: ftp://ftp.gnu.org/gnu/grep/, and given the tarball (ftp://ftp.gnu.org/gnu/grep/grep-2.5.1.tar.gz),
tar xf 2.5.1.tar.gz
cd 2.5.1
./configure
make && make install
(this will probably install into /usr/local/bin — you should read the instructions, e.g., the --prefix option to suit your own needs).
That assumes you are developing, and have installed gcc (the Cygwin setup program helps in that case).

Related

How do I install ack on OS X (10.8.4)?

I am new to OS X and I am unable to figure out how to install ack. The instructions here didn't help, because the command "install" is failing. Please guide me proper commands.
So far, I have downloaded ack 2.04 and placed it in the /usr/bin folder and then ran perl Makefile.PL successfully. The next command install isn't working for me.
If you use Homebrew you can simply do:
$ brew install ack
If you are new to OSX I highly recommend this approach because it makes installation of stuff like this MUCH easier. It is a package manager for OSX.
Homebrew link: http://brew.sh/
You can also use the MacPorts installer for OSX:
sudo port install p5.<nn>-app-ack
where <nn> is the version of your Perl installation (Ack is written in Perl). If you don't know the version of Perl you have installed, just type:
perl --version
and you'll know what you need for the port command. The Ack installation page has the information you need for this. More information about MacPorts can be found here.
Searching the web, you'll find LOTS of opinions about Homebrew versus MacPorts. I've used both; they both work (and both fail occasionally - installation of this kind is complex). You'll need to pick one or the other and stick with it as Homebrew doesn't play nicely with MacPorts (or vice versa, depending on your POV). Overriding choice for me is MacPorts as it has many more packages than Homebrew and it puts its stuff in /opt/local to stay out of the way of other programs. YMMV

Is it possible to debug bash scripts line-by-line?

I'll love something like Microsoft Visual Studio's line-by-line debugging in bash, with current variables values and so.
Is there any tool or way to do it? set -x and set -v are nice but not perfect.
See bashdb.
If it's installed on your system, see man bashdb.
If it's not installed, see http://bashdb.sourceforge.net
Yes. Use "bashdb" from http://bashdb.sourceforge.net/
Latest version at time of writing
http://sourceforge.net/projects/bashdb/files/bashdb/4.2-0.8/
If you are on a Mac (like I was) then you might need to install the GNU version of Bash.
I did that using "MacPorts"
http://www.macports.org/
Once you have MacPorts...
port install bash
Then follow the instructions to
./configure (in bashdb unpacked directory)
make
sudo make install
Then add the folder where bashdb can be found in your PATH

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

Perl & CPAN upgrade help for OS X

Here is my problem. I am running OS X v10.7 (Lion) and want to set up an old Perl program I have written (was then using a Windows System with ActivePerl and then its ppm).
I read to use CPAN to install Perl modules (I am trying to install the Graph module). Whenever I tried to install it, it failed from a refused connection. Why? So I read that I should run the following to update CPAN and fix any broken links:
cpan> install Bundle:CPAN
cpan> reload cpan
cpan> index cpan
cpan> exit
However, after doing this I am stuck with this every time I try to do a CPAN install or upgrade:
New CPAN.pm version (v1.9800) available.
[Currently running version is v1.9456]
You might want to try
install CPAN
reload cpan
to both upgrade CPAN.pm and run the new version without leaving
the current session.
I was trying to use the default Perl stuff that is included in OS X rather than downloading ActivePerl. How do I fix CPAN and install the Graph Module?
PS: Running install CPAN and reload CPAN didn't do anything, but it generated the same message.
UPDATE
I was able to upgrade to v1.9800 doing a manual install (make, install) through the terminal. But I am still unable to install the Graph Module. Here is what I am getting:
http://cloud.jjnford.com/3D1C1H4217222b1p1O3a
UPDATE - PROBLEM SOLVED
I was finally able to solve the problem. I just moved the /User/jj/.cpan directory to User/jj/.cpan_bak and then reconfigured CPAN and the Graph Module installed with no fuss.
To solve this problem, do a manual upgrade of CPAN (apparently on OS X CPAN has trouble upgrading itself). You can download the source from here. After you have downloaded it uncompress it, create the make file from the Perl script, then run a make test, and finally if all goes well a make install.
$> tar -xvxf CPAN-1.9800
$> cd CPAN-1.9800
$> perl Makefile.PL
$> make
$> make test
$> make install
Now get rid of your old CPAN configuration:
$> mv ~/.cpan ~/.cpan.bak
Now when you run CPAN from the terminal you should be prompted for the configuration again. Once this is complete and CPAN has started you will notice this:
cpan shell -- CPAN exploration and modules installation (v1.9800)
So CPAN is now upgraded and working, and in my case I installed the Graph Module:
$cpan> install Graph
And everything works fine. I hope this helps somebody.
I have a fresh Mac OS X Lion and I updated CPAN without problems.
Installing XCode is not enough. Make, gcc, g++ are not installed by default.
To install them, one has to:
Start XCode, go to XCode->Preferences->Downloads and install component named "Command Line Tools".
I know this was solved, but do consider using "cpanminus" instead next time. It's faster and could save you a lot of hassle. You can either install App:cpanminus using cpanminus (see: App::cpanminus):
curl -L http://cpanmin.us | perl - --sudo App::cpanminus
And then to install any module and its dependencies simply run:
cpanm <module>
Alternatively you could use it directly from the web:
curl -L http://cpanmin.us | perl - --sudo <module>
I use it on my OS X Lion, and it works perfectly :)
Please excuse me for replying to this old post.
I had the same issue as the OP. Once I corrected the command to contain two colons instead of one (i.e. - Bundle::CPAN vs Bundle:CPAN), it worked as expected.

How to install scons on Mac OS X

Can you please tell me how can I install scons on MacOSX?
I don't see a mac specified download from http://www.scons.org/
Thank you.
An alternative to MacPorts would be to use HomeBrew, where you'd just to
brew install scons
Download the tarball and then refer to the first chapter of the user guide, Building and Installing SCons. In short:
# cd scons-1.2.0
# python setup.py install
Install MacPorts, then at the Terminal (Applications > Utilities > Terminal.app), type:
sudo port install scons
This command will automatically download and install scons for you. MacPorts requires that you have the developer tools installed, so if you don't, you will need to download and install the Xcode 3 DVD.
NOTE 1: Xcode 2.5 is the last version of Xcode that will work on Mac OS X Tiger.
NOTE 2: This may seem awfully painful if you don't already have MacPorts installed. However, you really should go this route, as MacPorts makes it easy to update installed software, it automatically manages dependencies between software, and it makes it easier to install other packages in the future.
If you have the Python setuptools, the following will install scons-1.2.0 from sourceforge:
easy_install scons
But bear in mind the issues people raise with setuptools.
Also, keep in mind this question and the answers about virtualenv and pip for isolating Python environments.
There is also a GUI installer for SCons on Mac OS X that I wrote available for download here:
https://github.com/rviney/scons-mac-installer
Since version 2.3.0 SCons should work without installing:
# get the source and switch to stable 2.3.0 version
hg clone https://bitbucket.org/scons/scons/ -r 2.3.0
# make sure to use Python 2 for now
python scons/src/scripts/scons.py
When running 2.3.0 from source, the SCons.__version__ is not set correctly, so EnsureSConsVersion() will likely to fail if that's ok for you.
pull down SCons source and put it in /Library/Python/X.X/. Make sure you have the dir structure like this: /Library/Python/X.X/SCons/init.py
remember, import searches for modules, and /Library/Python/XXX is by default in the search path.

Resources