# Mkmf and environment variables

**URL:** <https://www.ruby-forum.com/t/mkmf-and-environment-variables/88021>\
**Category:** Ruby\
**Created:** [March 7, 2007, 4:40pm UTC](https://www.ruby-forum.com/t/mkmf-and-environment-variables/88021 "2007-03-07T16:40:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![has](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/da6949/32.png) [@has](https://www.ruby-forum.com/u/has)\
**Post date:** [March 7, 2007, 4:40pm UTC](https://www.ruby-forum.com/t/mkmf-and-environment-variables/88021/1 "2007-03-07T16:40:54Z")

</div>

Hi all,

I need to set an environment variable before building a Ruby C  
extension:

MACOSX\_DEPLOYMENT\_TARGET=10.2  
export MACOSX\_DEPLOYMENT\_TARGET

For simplicity and robustness I’d rather this happened automatically  
when the Makefile was run. Is there some way for by extconf.rb file to  
tell mkmf to add the above lines to the Makefile when generating it?

Many thanks,

has
