I must use this command to install MySQLnd on OS X. But I can't understand where exactly must I use it?
./configure --with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
[other options]
Those are flags for the configure step when compiling and installing PHP from source. You cannot do this after the fact, you need to entirely reinstall PHP from scratch for this. Depending on how exactly you installed PHP in the first place, there may be simpler options than doing this; for example by installing an extra package using the package manager you used to install PHP before.