Installing cx_Oracle on a Mac: 2017 Edition

Hello internet friends! I am back with a much needed follow up on my old cx_Oracle install guide on Mac from 2013. Thanks for everyone for the feedback over the years, and glad that I was able to help so many folks. After many comments (and a new MacBook), I have decided to polish up my guide. Luckily, it appears cx_Oracle is now on PyPI (no more compiling it yourself!) and the process is much much easier! Let’s get started!

What’s new from last time?

  • No more need for sudo access; leverage user space properly.
    • sudo/root should generally be reserved for system level operations or at least operations you are familiar with. Never trust random sudo commands you find, they can seriously mess up your system.
    • This was one of my biggest complaints about the old article
  • No more compiling cx_Oracle from SourceForge.
    • It is now in PyPI…thank you sweet developers!
  • It works in a virtualenv
    • No longer do you need to setup cx_Oracle at the system level! You can now use standard virtualenvs. Nothing is stopping you from installing at the system though!
  • It works in Python 3.
    • Time to move to Python 3 everyone. This guide is written for Python 3, although the steps for Python 2 shouldn’t be too different.
  • Less steps overall
    • Before there was a bunch of unzip library files and also symlinking random files. I don’t have time to check but it looks like the process has been improved significantly.

Necessary Downloads:

  1. Oracle 12.1 Instant Client 64-bit Libraries
    1. Instant Client Basic
    2. Instant Client SDK
  2. virtualenv – Optional but avoids polluting system pip environment by creating virtual python environments!

Next Steps:
Assuming you downloaded all the above files (except virtualenv), and they are found in your Downloads directory, run the following commands:

mkdir /Users/<username_here>/oracle
mv /Users/<username_here>/Downloads/instantclient-* /Users/<username_here>/oracle
cd /Users/<username_here>/oracle
cd instantclient_12_1/
ln -s libclntsh.dylib.12.1 libclntsh.dylib
vim ~/.bash_profile


Run the following lines (you should add these lines to your .bash_profile too):

export ORACLE_HOME=/Users/<username_here>/oracle/instantclient_12_1


Once you enter all the info, you should re-source your bash_profile. Once your changes are in your .bash_profile, the instant client should be setup! Validate all your settings are correct by doing:

. ~/.bash_profile
echo $ORACLE_HOME # should be /Users/username_here/oracle/instantclient_12_1 if you followed this guide
echo $LD_LIBRARY_PATH # same as above
which python # usually /usr/bin/python or your virtualenv


If all of the above is set, then you are ready to proceed with the cx_Oracle install!

. ~/.bash_profile
mkdir /Users/username_here/virtualenvs
cd /Users/username_here/virtualenvs
pip install virtualenv # If you haven't already
virtualenv --python=python3.6 venv # It's 2017, time for Python 3
. venv/bin/activate
pip install cx_Oracle


If all went according to plan, it should have successfully installed! (if not post in the comments and I can help!) To test simply:

>>> import cx_Oracle
>>> cx_Oracle.version
>>> conn = cx_Oracle.connect('pythonhol/welcome@')
>>> conn.version
>>> conn.close()


Hopefully this new and improved guide gets you folks up and running faster! As always, I look for your feedback below!

Moving my Blog

I am in the process of failing over my website from GoDaddy to AWS. Trying to tune WordPress to run a bit more optimally using RDS, proper caching, etc. The plan is to eventually migrate away from WordPress to my own Django Blog Engine but that is still in development.

You might see some bumpy things happening, but I hope for this to be relatively painless for all of you!

EDIT: And we are back online! This page is smoking fast now and SEO optimized! Finally broke away from GoDaddy! Right now, I am running in a VPC in AWS using RDS! That’s a 2015 goal complete!

Download an SSL Certificate using a one-liner!

Had a task today to sync up a SSL certificate, only problem is I didn’t have the certificate nor could I find it anywhere. I knew I could use openssl and get a print out, but I wanted a actual file in my tmp directory. So obvious start with the basics…

openssl s_client -connect HOST:PORTNUMBER

Simple, straight forward…next how to I pipe this to a file. My gut told me:

openssl s_client -connect HOST:PORTNUMBER > /tmp/out.cert

Well…That worked…sort of. I want to be able to terminate this so I don’t have to hit ctrl+c. Well what if I pipe it to echo…

echo | openssl s_client -connect HOST:PORTNUMBER

Bingo! That worked marvelously! But wait…drats…extra stuff about the cert chain. Googled around and found someone already did the heavy lifting using sed!

echo | openssl s_client -connect HOST:PORTNUMBER | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/websitessl.cert

Awesome! Now I have a clean importable cert. That will save the certificate to /tmp/websitessl.cert.

Thanks Sean and Vinay from Serverfault. They actually had some extra tips I picked up too!

1) You can use -showcerts if you want to download all the certificates in the chain. But if you just want to download the server certificate, there is no need to specify -showcerts

2) echo -n gives a response to the server, so that the connection is released

So TLDR is, just use:

echo -n | openssl s_client -connect HOST:PORTNUMBER | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/websitessl.cert


Google IO 2014 Here I Come!

So thanks to an awesome individual, I got a invite code to Google IO 2014! Booked my flight, booked my (EXPENSIVE) Hotel, and got all my bags packed. Looking forward to stepping a bit outside my comfort zone and focus on my development skills more.

Looking forward to learning more on the Chrome side and also picking up some more info on the wearables. Thinking the Moto 360 and/or LG G watch are gonna be hot coming this fall. Once Apple lets their iWatch out, this is going to be big. We just need to wait and see.

Wish me luck, hope to learn a lot!

PyCon 2014 Day 3: The big day is here!

So I apologize right now, if you consider these blog posts too much! I don’t usually get much time to write some blog posts but I thought I would share some great talks and my notes on a few of them.

Today, was the “official” first day of PyCon with some awesome Keynote speakers and also big talks. Again, this is my first PyCon so I was a bit new to talk tracks. However, I think I found all of the talks interesting that I attended 🙂


The main keynote was given by John Perry Barlow and it was a fun and pleasurable talk about privacy and policy. Had me chuckling, and at times made some very good points. Talked about how we should have a lack of secrecy, and how we should not be afraid about large controlled corporations. Nice talk to listen too.

Computer Science Fundamentals for Self-Taught Programmers

Took this talk to get a grip of the big O notation as that has been one of my bigger weaknesses when it comes to programming. Big O notation (O(n)) is a way developers talk about the theoretical measure of the execution of an algorithm. At the end of a day, algorithm is just a fancy way of saying a recipe (a step by step guide on how to do something). While big O notation is very important, for really small sample sizes, it can not just matter. Always remember that theoretical speed is different than practical speed. In short, unless you are coding for large datasets this is probably not going to make your app faster. With all this being said it is still something you should be familiar with because it allows you to discuss your code in an organized format with other developers. I still need some work in this domain regardless but I honestly just need to refocus because I was able to do this roughly a year ago. That’s what happens when you don’t hone your craft! 🙂

So you want to be a full stack developer?

This talk briefly touched a ton of tools available for a full stack setup. I consider myself a full stack developer in that all (almost all) of my code is essentially written and maintained by me from beginning to end. This talk was useful not in the sense of planning, but finding out what is out there in the world! I got a list, and I am not going to bore you with a long winded list, but if you wish. Please reach out and I can share!

Python Web Scraping Showdown

In a short demo, @kjam, talked about different web scraping utilities in Python and how they differ in speed. In short, lxml with xpath was the fastest, lxml with css was a close second, and finally BeautifulSoup came in last. With that being said, at the end of the day, the results weren’t that much different. I would say, use what is easiest to read and understand.


Ansible – Python Powered Automation  #3

Things I like about Ansible:

  • Agentless (no remote resources used)
  • Keeps things simple
  • Auditable
  • Batteries are included (Close to 250 plugins in core)

I think the only issue I see is that we have committed to puppet and salt, but I definitely don’t disregard Ansible as a powerful tool. In fact, it may become a leader in this domain. It has BLOWN up on Github in the past year.

Puppet Modules: Apps for Ops  #2

I attended this talk to see if there were any gotchas in our setup. I use puppet at the moment, but I think I was recently won over by Salt. 🙂


Getting Started with SaltStack  #1

I recently fell in love with salt after the heartbleed mess in the past week. I was tasked with finding out all our server config to see what needed to be patched. In a short salt command on our master, I ran the following command and did a complete inventory of our openssl versions:

sudo salt * “openssl version” >> out.txt

Aside from this, I like the whole Jinja2 (coming from a django background) and yaml based config files. I also like the level of granularity (haha a pun…go figure :p). I am also interested in their Salt Reactor. Basically you can listen in to events that occur, and “react” to them in a proper fashion. It uses Zeromq implementation which in itself if kind of interesting. I have not read much about it but looks like a cool setup. 😀



Application Deployment State of the Onion

Watch this video….Fast…and less than 30 minutes. Probably the greatest talk of the day in my book. No nonsense and straight to the point.

Writing Idiomatic Python

I got around to meeting up with Jeff Knupp, author of the book Writing Idiomatic Python, and we had a little meetup in one of the huddle rooms. Discussed a bit about writing a book and some of the challenges, and we got to discuss what it means to be idiomatic. There were a few people who had some comments on some of the idioms of Python, but as Jeff pointed out. The book is not based on his opinion and he might share the same views as someone, but he is simply writing a book about the idioms that are accepted by Python as a whole. Very interesting talk and also got a signed book out of it.

All the PyCon videos and talks can be found at:

Day 4 recap coming tomorrow night!

Featured on ThinkChicago!

Last year, I applied (along with 600 others) and I was one of the lucky 100 selected to participate in the City of Chicago’s ThinkChicago program. This is a program that takes young entrepreneurs and technologists around the city; showing off its awesome tech scene, the various companies in the city, and gave great talks about starting your own business.

Overall, it was probably one of the best weekends I participated in because I got to meet some amazing and very talented people and I also got see my beautiful city in all its technological glory. Chicago is still young in terms of technology, but it is quickly evolving. On top of it all, the program also provided passes and an exclusive look behind Lollapalooza! It was quite an experience and I recommend anyone reading this that is still a student to apply! I promise it will be one to remember! I have added links below to find more info you are interested 🙂

Recently, I was told that I would be featured on the main page of the new website! This is truly an honor, and very cool to be on the official page where other prospective students may apply. As always, anytime I can make my city better, I go for it! Check it out at the link below and let me know what you think! 🙂



Apply Link:

Original Article:

Skype! Stop using my port 80!

So this weekend, I decided to spend some time on my Windows machine and do some work. Per the usual, I booted up as normal and tried to start up my web server…until I saw this:


So I got to my usual checking around and saw nothing out of the ordinary. I then proceeded to check what was eating up port 80 on my machine!

netstat -ano |find /i "listening"|find /i ":80"

Something was already running? On port 80? What could this be? So I looked it up via the tasklist command:

tasklist /FI “PID eq 4000″

and saw the culprit….Skype? This can’t be right… After doing some quick browsing…this is intended. The reason Skype has this enabled is so they can bypass some firewalls and such. Blah! So in short there is a solution, oddly enough it is so common that it is even documented by Skype! Well, to fix this issue, just go to Skype>>Tools>>Options. Next, go to Advanced>>Connection and uncheck that box; “Use port 80 and 443 as alternatives…”! After this you will be good to go! Hope this helps someone else in the world 🙂


Fixing SSL Errors routing to localhost

So over the course of the weekend, I was maintaining an application that essentially redirected all http traffic to https back to itself. Normally this wasn’t an issue but the application was being stubborn and tossing sslcert issues.

At first, I said, Ah ha! Must be a cert issue. Took the time, certs were ok.

Next, I said, oh must be a routing issue! Nope, I saw all the traffic coming and going. I saw NO traffic at all for this bad request. This had me thinking…what if it never needs to touch my network at all?

What was going on? Turns out the server was missing a self signed localhost ssl cert.

In short running:

openssl req -new -x509 -newkey rsa:2048 -keyout /etc/pki/tls/private/localhost.key -nodes -days 3650 -out /etc/pki/tls/certs/localhost.crt

fixed my issues.

With all this being said, there are some issues with running your own self signed certs, but normally by that time the actual machine has already been compromised. A good read is linked below! Happy Saturday all!

Credit Card Regex

After searching the internet for a credit card regex pattern, I found a lot of roundabout answers and no clear cut regex pattern. I aim to change that! Here is a regex pattern you can use to match credit cards (disclaimer: it may not work 100% for you but after a few tweaks I am sure it will!)


If you have your own cool regex to share, post it in the comments! Hope this helps someone out there!

A Break From The Norm

So it’s that time of year, we have to come and reflect what we are all thankful for. I want to take this time to thank so many people in my life…here it goes.

Thankful for all the blessings I had this year; graduated college, got my first job, been given good health. Even achieving one of those things is amazing, the fact that I did all those things (with the help and support of all my friends and family) is really a blessing. Just know that with y’alls support, I would be nothing. You all motivate me to get better and better, and you never fail to do so.

I am thankful for having the best coworkers in the world. Y’all mentored me, y’all took me under your wings as a novice intern. I hope that you have learned from me as the way I have learned from you. The fact that I enjoy waking up, going to work, and working with all you is an amazing thing. Not many people can say they love their job; but I am proud to say that I do thanks to all of you.

Next, I am thankful my sports crew. We play basketball, we play football, heck we even play softball. We lift together, we eat together. We play hard, and even though we may play hard on the court/field, off the field we are all friends. No hate, just love for the game and one another.

I am thankful for all the new friends I have made this year. It is always good to have good people in your life. I have meet some strong willed and inspiring people this year; ThinkChicago, DePaul Linux Community, Graduation, etc. Don’t ever change! 🙂

Next, I wanna be thankful for my concert crew. Lollapalooza? Riot Fest? NorthCoast? I try to make those festivals fun for y’all when we hang out, and you guys and gals do likewise; even though I do get a bit…rowdy hehe. Fun times! Let’s do it again 2014? 🙂

Finally, I am extremely thankful for all the close friends and family. You all know who you are; you guys/gals are always there for me even when I am at my lowest. I hope you all realize that I am there for you all too.

Happy Thanksgiving all! At the risk of sounding cheesy, “Money will come and go. The most important thing in life will always be the people you know. Salud, mi familia.”