assigning static IP with command line
I'm going to side step things to get you something that will probably work just fine.

Open System Preferences and delete your WiFi and Ethernet configurations once you have saved all the work you need from the internet.


Add a WiFi connection and connect that to a WiFi Router with Internet Connection.
Then add an ethernet connection and make that a static IP


I would make two networks initially so you don't have issues with which interface gets the default route:

If your WiFi is something other than 192.168.1.1 - then you can use 192.168.1.1 for the Mac ethernet and the Mac default gateway. If the WiFi is on 192.168.1.1 then put the Mac and PI on 192.168.2.1 and 192.168.2.40 for example. 



I don't have an ethernet port on their mac, so forgive the WiFi 2 name - you show have ethernet in that image.

At that point, your internet should work through WiFi and the Mac and the PI should be able to ping each other. The Pi won't see the internet through the Mac. If you want that, open Sharing preference pane and share the internet from the WiFi to the Ethernet port and turn off any firewalls to test things.

At that point, the Pi should use the Mac as it's router and everything should have access to the internet and each other.