# I unable to install aerospike in mac

**URL:** <https://discuss.aerospike.com/t/i-unable-to-install-aerospike-in-mac/8733>\
**Category:** General Discussion\
**Created:** [August 17, 2021, 7:19am UTC](https://discuss.aerospike.com/t/i-unable-to-install-aerospike-in-mac/8733 "2021-08-17T07:19:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dharmu](https://avatars.discourse-cdn.com/v4/letter/d/73ab20/32.png) [@dharmu](https://discuss.aerospike.com/u/dharmu)\
**Post date:** [August 17, 2021, 7:19am UTC](https://discuss.aerospike.com/t/i-unable-to-install-aerospike-in-mac/8733/1 "2021-08-17T07:19:53Z")

</div>

my aerospike service is running but i unable to run my code

# import the module

from **future** import print\_function import aerospike

# Configure the client

config = { ‘hosts’: [(‘127.0.0.1’, 2222)] }

# Create a client and connect it to the cluster

try: client = aerospike.client(config).connect() except Exception as err: print(err) import sys print(“failed to connect to the cluster with”, config[‘hosts’]) sys.exit(1)

# Records are addressable via a tuple of (namespace, set, key)

key = (‘test’, ‘demo’, ‘foo’)

try:

# Write a record

client.put(key, { ‘name’: ‘John Doe’, ‘age’: 32 }) except Exception as e: import sys print(“error: {0}”.format(e), file=sys.stderr)

# Read a record

(key, metadata, record) = client.get(key) print(record)

# Close the connection to the Aerospike cluster

client.close()

* * *

How i check what is port of this and what is he host name

---

<div class="post-metadata">

**Author:** ![neelp](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/neelp/32/1369_2.png) [@neelp](https://discuss.aerospike.com/u/neelp)\
**Post date:** [August 20, 2021, 5:41pm UTC](https://discuss.aerospike.com/t/i-unable-to-install-aerospike-in-mac/8733/2 "2021-08-20T17:41:49Z")

</div>

Are you running the server with Vagrant or in a Docker container? You may find these [vagrant](https://discuss.aerospike.com/t/connecting-to-server-when-running-vagrant-on-macos/3734) and [docker](https://dev.to/aerospike/getting-started-with-aerospike-enterprise-edition-on-docker-desktop-14i0) articles useful in connecting a client to the server (specifically the port forwarding part).

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/system/32/2274_2.png) [@system](https://discuss.aerospike.com/u/system)\
**Post date:** [August 20, 2022, 5:41pm UTC](https://discuss.aerospike.com/t/i-unable-to-install-aerospike-in-mac/8733/3 "2022-08-20T17:41:52Z")

</div>

Closed on August 20, 2022, 5:41pm UTC

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
